Skip to content

Login with Apple

Privy supports native Apple login when running on iOS. Apple is an OAuth2.0 compliant authentication provider, but requires a specific implementation of Apple sign-in within iOS apps.

TIP

Prior to integrating Sign in with Apple, make sure your app's Bundle ID rather than the Service ID, is configured as the Client ID within the Privy Dashboard.

Expo setup

Make sure you have installed the peer dependency expo-apple-authentication.

sh
npx expo install expo-apple-authentication

You can configure expo-apple-authentication using its built-in config plugin if you use config plugins.

In your app.json config file:

  • Set the ios.usesAppleSignIn property to true.
  • Add "expo-apple-authentication" to the plugins array.
json
{
  "expo": {
    "ios": {
      "usesAppleSignIn": true
    },
    "plugins": ["expo-apple-authentication"]
  }
}

Initializing the login flow

With Privy's SDK, you can use 'apple' just as any other OAuth provider.

tsx
import {useLoginWithOAuth} from '@privy-io/expo';

export function LoginScreen() {
  const {login} = useLoginWithOAuth();

  return (
    <View>
      <Button onPress={() => login({provider: 'apple'})}>Login with Apple</Button>
    </View>
  );
}

Use the web based flow instead

TIP

Privy will automatically fallback to the web-based flow on Android devices, where native Apple sign-in isn't supported.

For the best possible user experience, we recommend using the native "Sign in with Apple" flow as described above. However, if you are unable to use the native flow, or prefer not to, you can use the web based flow instead:

tsx
import {useLoginWithOAuth} from '@privy-io/expo';

export function LoginScreen() {
  const {login} = useLoginWithOAuth();

  return (
    <View style={styles.container}>
      <Button onPress={() => login({provider: 'apple', isLegacyAppleIosBehaviorEnabled: true})}>
        Login with Apple
      </Button>
    </View>
  );
}