How It Works
- Supabase
- Convex
| Provider | iOS/Android | Web |
|---|---|---|
| Native SDK (ID token exchange) | OAuth PKCE (browser redirect) | |
| Apple | OAuth PKCE via in-app browser | OAuth PKCE (browser redirect) |
@react-native-google-signin/google-signin to get an ID token directly, then exchanges it with Supabase. No browser redirect needed.Apple on mobile uses OAuth PKCE flow with expo-web-browser, which opens an in-app browser for authentication.Web OAuth redirects the browser to the OAuth provider (Google/Apple), then back to /auth/callback where the AuthCallbackScreen handles the token exchange automatically.Quick Start
- Supabase
- Convex
Google Sign-In Setup
- Supabase
- Convex
1. Create OAuth Credentials
In Google Cloud Console:- Create or select a project
- Go to APIs & Services → OAuth consent screen
- Configure app name, support email, scopes (
openid,email,profile)
- Configure app name, support email, scopes (
- Go to APIs & Services → Credentials → Create Credentials → OAuth client ID
- Create three client IDs:
- Web application - Copy the Client ID and Client Secret
- iOS - Use your bundle identifier
- Android - Use your package name and SHA-1 fingerprint
2. Configure Supabase
In Supabase Dashboard → Authentication → Providers → Google:- Enable Google provider
- Add the Client Secret (from Web client)
- Add all Client IDs (Web first, then iOS and Android) separated by commas
- Enable Skip nonce check - Required because the React Native Google Sign-In SDK doesn’t support nonce verification
3. Configure Your App
Add toapps/app/.env:4. Add Redirect URL
In Supabase Dashboard → Authentication → URL Configuration → Redirect URLs, add:yourappscheme://auth/callback(your app scheme fromapp.json)http://localhost:19006/auth/callback(local web development)
Rebuild Dev Client
After adding Google Sign-In, rebuild your development client:Apple Sign-In Setup
- Supabase
- Convex
1. Configure App ID
In Apple Developer Portal:- Go to Certificates, Identifiers & Profiles → Identifiers
- Select your App ID (or create one)
- Enable Sign In with Apple capability
- Save
2. Create Services ID (for OAuth)
- Go to Identifiers → Click +
- Select Services IDs → Continue
- Set identifier (e.g.,
com.yourcompany.yourapp.signin) - Enable Sign In with Apple
- Click Configure:
- Primary App ID: Select your main app
- Domains: Add your Supabase domain (e.g.,
your-project.supabase.co) - Return URLs: Add
https://your-project.supabase.co/auth/v1/callback
- Save
3. Generate Private Key
- Go to Keys → Click +
- Name it (e.g., “Supabase Auth Key”)
- Enable Sign In with Apple
- Click Configure → Select your Primary App ID
- Register the key
- Download the
.p8file (you can only download once!) - Note the Key ID
4. Configure Supabase
In Supabase Dashboard → Authentication → Providers → Apple:- Enable Apple provider
- Enter your Services ID (e.g.,
com.yourcompany.yourapp.signin) - Enter your Team ID (found in Apple Developer account)
- Enter your Key ID
- Paste the Private Key content (entire
.p8file including headers)
.env file.Mobile OAuth Requirements (Convex)
Why Mobile OAuth Requires Deployment
When using Convex Auth with OAuth providers (Google, Apple, GitHub), the authentication flow works like this: The OAuth provider (Google/Apple/GitHub) redirects to your Convex site URL (SITE_URL), not directly to your app. This means:
SITE_URLmust be publicly accessible - OAuth providers cannot redirect tolocalhostor127.0.0.1- Mobile simulators can’t reach localhost - Even if the OAuth flow started, the final redirect back to your app would fail
Environment Variables Required
Set these in the Convex Dashboard → Settings → Environment Variables:| Variable | Description | Example |
|---|---|---|
SITE_URL | Your Convex deployment URL (must be public) | https://your-project.convex.site |
AUTH_GOOGLE_ID | Google OAuth Client ID | 123456.apps.googleusercontent.com |
AUTH_GOOGLE_SECRET | Google OAuth Client Secret | GOCSPX-xxxxx |
AUTH_APPLE_ID | Apple Services ID | com.yourapp.signin |
AUTH_APPLE_SECRET | Apple Client Secret (JWT) | eyJhbGc... |
AUTH_GITHUB_ID | GitHub OAuth App Client ID | Iv1.abc123 |
AUTH_GITHUB_SECRET | GitHub OAuth App Client Secret | ghp_xxxxx |
Development Options
Option 1: Deploy to Convex Cloud (Recommended)
Option 1: Deploy to Convex Cloud (Recommended)
The simplest approach is to use a cloud Convex deployment for OAuth testing:Then update your app’s
.env:Your Convex site URL (ending in
.convex.site) is different from your Convex cloud URL (ending in .convex.cloud). Use the .convex.site URL for SITE_URL.Option 2: Use ngrok for Local Development
Option 2: Use ngrok for Local Development
If you want to test OAuth with your local Convex backend:
-
Start your local Convex dev server:
-
In another terminal, start ngrok:
This gives you a public URL like
https://abc123.ngrok.io -
Set SITE_URL to the ngrok URL:
- Update OAuth provider redirect URLs to include your ngrok URL
Option 3: Test OAuth on Web Only
Option 3: Test OAuth on Web Only
During local development, OAuth works on web but not mobile:Web OAuth works because:
- The browser can follow redirects to
localhost - Cookies are preserved through the OAuth flow
- No native app scheme is required
Configure OAuth Provider Redirect URLs
After setting up your Convex deployment, add these redirect URLs to your OAuth providers: Google Cloud Console:- Authorized redirect URIs:
https://your-project.convex.site/api/auth/callback/google
- Return URLs:
https://your-project.convex.site/api/auth/callback/apple
- Authorization callback URL:
https://your-project.convex.site/api/auth/callback/github
Deep Link Configuration
Your app needs to handle the final redirect from Convex. Ensure yourapp.json has the correct scheme:
convex/auth.ts validates these URLs:
Web OAuth Setup
Web OAuth works automatically with Shipnative! Just ensure your redirect URLs are configured correctly.
AuthCallbackScreen component which:
- Extracts tokens from the URL hash fragment (
#access_token=...&refresh_token=...) - Exchanges them for a session with Supabase
- Redirects to the authenticated area of your app
Required Configuration
- Supabase
- Convex
Add these redirect URLs in Supabase Dashboard → Authentication → URL Configuration → Redirect URLs:
Google Cloud Console (Web Client)
For Google OAuth on web, ensure your Web application OAuth client has:-
Authorized JavaScript origins:
http://localhost:19006(development)https://yourapp.com(production)
-
Authorized redirect URIs:
- Your Supabase callback URL:
https://your-project.supabase.co/auth/v1/callback
- Your Supabase callback URL:
How It Works Technically
Troubleshooting
General Issues
“Google Sign-In is not available on this platform”- Ensure
@react-native-google-signin/google-signinis installed - Rebuild your dev client after adding native modules
- Check that
EXPO_PUBLIC_GOOGLE_CLIENT_IDis set correctly - Verify the Web Client ID matches what’s in Google Cloud Console
- Apple Sign-In is iOS and Web only. Hide the button on Android:
- Verify redirect URLs match your app scheme
- Check backend configuration for correct callback URLs
Supabase-Specific
“Nonce mismatch” errors- Enable Skip nonce check in Supabase Google provider settings
- Ensure your redirect URL in Supabase includes
/auth/callback - Check that
detectSessionInUrl: trueis set in the Supabase client config (default in Shipnative) - Verify your domain is in the allowed redirect URLs in Supabase Dashboard
- Check browser console for CORS errors
- Add your domain to Supabase’s allowed origins (Dashboard → Project Settings → API)
- Ensure tokens aren’t being stripped by your hosting provider’s redirects
Convex-Specific
Mobile OAuth shows “Convex Auth is running” page instead of OAuth provider This happens whenSITE_URL is set to localhost or 127.0.0.1. The OAuth flow is trying to use your local Convex server, which mobile devices can’t access.
Fix:
- Check that
expo-web-browseris installed:npx expo install expo-web-browser - Verify the OAuth provider credentials are set in Convex Dashboard
- Check Convex function logs for errors:
npx convex logs
convex/auth.ts:
- Is
SITE_URLset to a public URL? (not127.0.0.1orlocalhost) - Are OAuth credentials set in Convex Dashboard?
- Are OAuth provider redirect URLs configured with your
.convex.sitedomain? - Does your
app.jsonhave the correct scheme?
[Convex Auth] log messages that show the redirect flow.

