This guide covers the complete Google Sign In integration for TribeFind using native mobile authentication without requiring Supabase OAuth provider setup.
- ✅ Native Google Sign In service (
GoogleSignInService.ts) - ✅ Manual user creation/authentication in Supabase
- ✅ Direct email-based user management
- ✅ Automatic profile creation for new users
- ✅ Google Sign In button in AuthScreen
- ✅ Professional styling with Google branding
- ✅ Loading states and error handling
- ✅ Seamless integration with existing auth flow
- ✅ iOS Client ID configuration
- ✅ app.json plugin configuration
- ✅ GoogleService-Info.plist setup
- ✅ URL scheme configuration
{
"@react-native-google-signin/google-signin": "^15.0.0"
}1. User taps "Continue with Google"
2. Native Google Sign In modal appears
3. User authenticates with Google
4. App receives user info (email, name, photo)
5. App checks if user exists in Supabase users table
6. If exists: Sign in with Supabase auth
7. If new: Create Supabase auth user + profile
8. User logged into app
// app.json
{
"ios": {
"googleServicesFile": "./GoogleService-Info.plist"
},
"plugins": [
[
"@react-native-google-signin/google-signin",
{
"iosUrlScheme": "com.googleusercontent.apps.928204958033-cupnqdn1nglhhfmj5pe5vl0oql4heg9s"
}
]
]
}<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>928204958033-cupnqdn1nglhhfmj5pe5vl0oql4heg9s.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.928204958033-cupnqdn1nglhhfmj5pe5vl0oql4heg9s</string>
<key>BUNDLE_ID</key>
<string>com.jfuginay.tribefind</string>
</dict>
</plist>Traditional Web OAuth: Requires redirects, client secrets, complex setup Our Mobile Approach: Native sign-in → direct user management
Benefits:
- ✅ Better UX (native modal vs web redirect)
- ✅ No client secret required (iOS is public client)
- ✅ Simpler configuration
- ✅ More secure (no web-based flows)
- ✅ Works perfectly with Supabase
// 1. Google Sign In
const result = await GoogleSignInService.signIn()
// 2. Check existing user
const existingUser = await supabase
.from('users')
.select('*')
.eq('email', result.user.email)
.single()
// 3. Create or authenticate
if (existingUser) {
// Sign in existing user
await supabase.auth.signInWithPassword({
email: result.user.email,
password: 'google-oauth-user'
})
} else {
// Create new user
const authData = await supabase.auth.signUp({
email: result.user.email,
password: 'google-oauth-user',
options: { data: { provider: 'google' } }
})
// Create profile
await supabase.from('users').insert(profileData)
}Configure these settings in console.cloud.google.com:
Create iOS OAuth Client:
Application Type: iOS
Bundle ID: com.jfuginay.tribefind
Name: TribeFind iOS
No Web Client Needed: Unlike traditional setups, we don't need a separate web client for this approach.
Important: No Google OAuth provider setup required!
What we DON'T need:
- ❌ Google provider configuration
- ❌ Client secret
- ❌ Redirect URLs
- ❌ OAuth flow setup
What we DO use:
- ✅ Standard email/password authentication
- ✅ User table for profiles
- ✅ Regular Supabase auth sessions
- Physical iOS device (Google Sign In doesn't work in simulator)
- Google account for testing
- Valid Google OAuth iOS client
- Internet connection
- Tap "Continue with Google"
- Google sign-in modal appears
- Sign in with Google account
- App creates new user profile
- User lands on HomeScreen
- Check user appears in Supabase users table
- Sign out from app
- Tap "Continue with Google"
- App recognizes existing user
- User signs in automatically
- Profile data preserved
- No internet connection
- User cancels sign-in
- Invalid OAuth configuration
- This is Android-specific, shouldn't occur on iOS
- Indicates configuration issue
- User cancelled the flow
- Handle gracefully with appropriate message
- Check GoogleService-Info.plist is included
- Verify bundle ID matches exactly
- Ensure URL scheme is correct
- Check Supabase connection
- Verify users table schema
- Check for email conflicts
🔐 Starting Google Sign In...
✅ Google Sign In successful: { email, name, photo }
👤 Existing user found, signing in...
✅ Google Sign In and user processing complete
// eas.json - no changes needed
{
"development": {
"ios": {
"simulator": false,
"device": true
}
}
}# Ensure ios directory is removed for clean prebuild
rm -rf ios
# Build for device testing
eas build --profile development --platform ios- Google OAuth iOS client configured
- GoogleService-Info.plist included
- Bundle ID consistent across all platforms
- URL schemes properly configured
- No Supabase Google provider needed
- Google Sign In works on physical device
- User profiles created correctly
- Existing users can sign in
- Error handling works properly
- Simpler Setup: No client secrets, redirect URLs, or complex OAuth flows
- Better UX: Native modal instead of web redirects
- More Secure: No secrets in client code
- Easier Debugging: Direct user management
- Platform Optimized: Uses iOS-native Google Sign In
- Seamless: Works with existing Supabase auth
- Flexible: Easy to add other OAuth providers
- Maintainable: Clear separation of concerns
- Scalable: Standard user management patterns
Files Modified:
services/GoogleSignInService.ts- Native Google Sign Inservices/AuthService.tsx- Manual user managementscreens/AuthScreen.tsx- Google sign in UIApp.tsx- Initialize Google Sign Inapp.json- Google OAuth configurationGoogleService-Info.plist- iOS OAuth config
Key Features:
- ✅ Native Google authentication
- ✅ Automatic user profile creation
- ✅ Seamless Supabase integration
- ✅ No client secrets required
- ✅ Professional UI/UX
Why This Works Better: Mobile apps are "public clients" in OAuth terms, meaning they can't securely store secrets. Google's iOS SDK handles this by using native authentication that doesn't require secrets, making our approach both more secure and simpler to implement.
Task completed! "That's what she said." - Michael Scott