Google Sign-In in React Native CLI Cheat Sheet
Google Sign-In works only after native config, OAuth client IDs, and a rebuild. Skip any one, and the button silently does nothing.
Action Steps
- Set App.tsx container style flex: 1; center GoogleSigninButton with alignItems: center.
- Rebuild with npm run ios after pod install, since new native packages need it.
- In Xcode: target → Info → URL Types; paste the iOS client value from Google Cloud.
- Set OAuth consent screen: User type External, add developer email, scopes, two Gmail test users.
- Copy bundle ID from android namespace in android/app/build.gradle; use it for iOS and Android.
- Generate Android SHA-1 with keytool in the android folder (keystore password: android).
- Start from the official sample sign-in.ts, fix response handling to clear errors, log with console.log.
- Publish consent screen to Production so any Google account can sign in.
- Send returned token to your back end to authenticate users.
Key Terms
- OAuth consent screen: Google setup page defining user type, scopes, and test users; status moves from Testing to Production.
- SHA-1 fingerprint: Certificate hash generated with keytool, registered in Google Cloud for the Android OAuth client.
- Bundle ID: Unique app identifier; here, one value shared by iOS and Android, read from build.gradle.
Pitfalls to Avoid
- Skipping pod install causes "Native module not found" errors, wasting a full rebuild.
- Missing Xcode URL scheme makes the button do nothing, with no visible error.
- Staying in Testing status blocks accounts not on the test-user list from signing in.
Statistics
- Users allowed before app verification: 100
- Test Gmail accounts added in setup: 2
Related cheat sheets
More like this