the smoothest social login in an Expo + Supabase app doesn't open a browser at all. Use the native sign-in sheet on each platform (expo-apple-authentication for Apple, the Google Sign-In SDK for Google), take the ID token it returns, and pass it to supabase.auth.signInWithIdToken(). Most of the work is configuration: client IDs in Supabase, the right SHA-1 fingerprints on Android, and one setting for nonce errors on iOS.
There are two ways to add Google or Apple login to a mobile app with Supabase:
- Browser-based OAuth: open a web page, sign in, redirect back to the app with a deep link.
- Native ID token sign-in: show the platform's own sign-in UI, get an ID token, exchange it for a Supabase session.
The first works, but users see a browser pop up, sometimes have to sign in again, and redirects can fail in ways that are hard to debug. The second feels like part of your app: a Face ID sheet for Apple, a native account picker for Google. This guide covers the second.
What you need
- An Expo app using development builds (both sign-in libraries include native code, so they won't run in Expo Go).
- A Supabase project with the client set up for mobile (session stored on device,
detectSessionInUrl: false). - An Apple Developer account and a Google Cloud project.
Part 1: Sign in with Apple
Configure
- In the Apple Developer portal, enable Sign in with Apple for your app's identifier.
- In Supabase, open Authentication → Providers → Apple, enable it and add your app's bundle identifier to the client IDs.
- Install the library and enable the capability:
npx expo install expo-apple-authentication
{
"expo": {
"ios": {
"bundleIdentifier": "com.yourcompany.yourapp",
"usesAppleSignIn": true
},
"plugins": ["expo-apple-authentication"]
}
}
Sign in
// src/auth/apple.ts
import * as AppleAuthentication from 'expo-apple-authentication';
import { supabase } from '@/lib/supabase';
export async function signInWithApple() {
const credential = await AppleAuthentication.signInAsync({
requestedScopes: [
AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
AppleAuthentication.AppleAuthenticationScope.EMAIL,
],
});
if (!credential.identityToken) throw new Error('No identity token from Apple');
const { error } = await supabase.auth.signInWithIdToken({
provider: 'apple',
token: credential.identityToken,
});
if (error) throw error;
// Apple only returns the name on the FIRST sign-in. Save it now or lose it.
const given = credential.fullName?.givenName;
if (given) {
const fullName = [given, credential.fullName?.familyName].filter(Boolean).join(' ');
await supabase.auth.updateUser({ data: { full_name: fullName } });
}
}
Use Apple's official button so it matches Apple's guidelines:
<AppleAuthentication.AppleAuthenticationButton
buttonType={AppleAuthentication.AppleAuthenticationButtonType.SIGN_IN}
buttonStyle={AppleAuthentication.AppleAuthenticationButtonStyle.BLACK}
cornerRadius={12}
style={styles.appleButton}
onPress={signInWithApple}
/>
The button needs an explicit height and width, so give it a style from StyleSheet.create.
Android: native Sign in with Apple is an iOS feature. On Android, either hide the Apple button or fall back to Supabase's browser-based Apple OAuth. Apple's requirement to offer it applies to your iOS app.
Part 2: Native Google Sign-In
Configure Google Cloud
In Google Cloud Console, under APIs & Services → Credentials, create OAuth client IDs:
-
Web client: used by Supabase to verify tokens. You'll pass its ID to the SDK as
webClientId. - iOS client: with your bundle identifier.
- Android client: with your package name and the SHA-1 fingerprint of every key that signs your app (more on this below).
In Supabase, open Authentication → Providers → Google, enable it, and add the web client ID and secret, plus the iOS and Android client IDs in the authorized client IDs field.
Install
npx expo install @react-native-google-signin/google-signin
{
"expo": {
"plugins": [
[
"@react-native-google-signin/google-signin",
{ "iosUrlScheme": "com.googleusercontent.apps.YOUR-IOS-CLIENT-ID" }
]
]
}
}
The iosUrlScheme is your iOS client ID reversed, as shown in Google Cloud. Rebuild your development build after adding the plugin.
Sign in
// src/auth/google.ts
import { GoogleSignin } from '@react-native-google-signin/google-signin';
import { supabase } from '@/lib/supabase';
GoogleSignin.configure({
webClientId: process.env.EXPO_PUBLIC_GOOGLE_WEB_CLIENT_ID,
iosClientId: process.env.EXPO_PUBLIC_GOOGLE_IOS_CLIENT_ID,
});
export async function signInWithGoogle() {
await GoogleSignin.hasPlayServices();
const response = await GoogleSignin.signIn();
// Recent versions return { type, data }; check the version you installed
if (response.type !== 'success') return; // user cancelled
const idToken = response.data.idToken;
if (!idToken) throw new Error('No ID token from Google');
const { error } = await supabase.auth.signInWithIdToken({
provider: 'google',
token: idToken,
});
if (error) throw error;
}
Older versions of the library return the user info directly (with idToken at the top level). If you're upgrading, check the library's migration notes.
The errors everyone hits (and the fixes)
DEVELOPER_ERROR on Android
This almost always means the SHA-1 fingerprint of the key that signed this build isn't registered on your Android OAuth client. The catch: your app may be signed by several keys:
- Your local debug key when running locally.
- Your EAS upload key for builds from EAS (see it with
eas credentials). - Google Play's app signing key for apps installed from Play (find it in Play Console under app integrity).
Register the SHA-1 for each one you use. A login that works in development and fails only after installing from Google Play is the classic sign that the Play signing key is missing.
Nonce errors on iOS with Google
On iOS, the Google SDK can include a nonce in the ID token, and Supabase's token verification may reject it. Supabase's Google provider settings include an option to skip the nonce check for this case. Read the security note in Supabase's docs before enabling it, and only enable it if you see this specific error.
"Unacceptable audience in id_token"
The token was issued for a client ID that Supabase doesn't know. Add every client ID you use (web, iOS, Android) to the Google provider in Supabase.
Apple name is empty
Apple only shares the name on the very first sign-in for your app. If you didn't save it then, the user can remove your app from their Apple ID's "Sign in with Apple" settings to make it ask again during testing.
Linking accounts
If someone signs in with Google one day and Apple the next, using the same verified email, Supabase can link both identities to one user automatically. Two things break that:
- Hide My Email. Apple users who hide their email get a private relay address, so it won't match their Google email. They'll get a separate account unless you add manual linking in settings.
- Unverified emails. Automatic linking relies on verified emails, which protects against account takeover.
If one account per person matters for your app, offer a "connected accounts" section in settings where signed-in users can link their other provider.
Before you ship
- Sign in with Apple is required on iOS if you offer Google or other social login, and its button should be at least as prominent as Google's.
- Account deletion must be available in the app. For users who signed in with Apple, revoke their Apple tokens as part of deleting the account.
- Private relay emails: if you send email, register your sending domain with Apple's private email relay service so messages reach "Hide My Email" users.
- Test on real devices with fresh accounts, including a build installed from TestFlight and from Google Play's internal testing track (that's where signing-key problems show up).
Conclusion
Native social sign-in is one of the biggest UX upgrades you can give an Expo app: no browser, no redirects, one tap. The code is short: get an ID token from the native SDK and pass it to signInWithIdToken. The real work is configuration, so register every client ID and every signing key's SHA-1, save Apple's name on the first sign-in, and test from store builds before launch.
Which error cost you the most time: DEVELOPER_ERROR, nonce or audience? Share your fix in the comments.
Top comments (0)