Expo setup
Prepare your Expo project
With Expo SDK 50, minimum iOS version was bumped to 13.4. In case you get an error during pod install step, please see release notes to determine the right version of this package to install.
This package cannot be used in Expo Go because it requires custom native code.
However, you can add custom native code to an Expo app by using a development build. Using a development build is the recommended approach for production apps, and is documented in this guide.
npx expo install @react-native-google-signin/google-signin
Add config plugin
After installing the npm package, add a config plugin (read more details below) to the plugins
array of your app.json
or app.config.js
. There are 2 config plugins available: for projects with Firebase, and without Firebase.
Expo without Firebase
If you're not using Firebase, provide the iosUrlScheme
option to the config plugin.
To obtain iosUrlScheme
, go to the Google Cloud Console and copy the "iOS URL scheme" from your iOS client in the "OAuth 2.0 Client IDs" section.
{
"expo": {
"plugins": [
[
"@react-native-google-signin/google-signin",
{
"iosUrlScheme": "com.googleusercontent.apps._some_id_here_"
}
]
]
}
}
Expo and Firebase Authentication
If you are using Firebase Authentication, obtain the 2 Firebase config files and place them into your project. Then specify the path to the files:
{
"expo": {
"plugins": ["@react-native-google-signin/google-signin"],
"android": {
"googleServicesFile": "./google-services.json"
},
"ios": {
"googleServicesFile": "./GoogleService-Info.plist"
}
}
}
Ensure compatibility
If you're using the sponsor package:
If you're using Expo SDK >= 50, you're good to go.
But if you're using Expo 49 or older, you need to specify compileSdkVersion
34 of your project using Expo BuildProperties.
Rebuild the app
Then run the following to generate the native project directories.
npx expo prebuild --clean
Next, rebuild your app and you're good to go!
npx expo run:android && npx expo run:ios