Signin with Apple with Expo's app.json
Apr 13, 2024Motivation #
Apple’s Sign in with Apple feature is a convenient way for users to sign in to your app without creating a new account. It provides a secure and private way to authenticate users and helps you comply with privacy regulations. If you are building an application to distribute on the App Store and you offer third-party sign-in options, you must include Sign in with Apple as an option.
Expo team has made their own implementation of Sign in with Apple library expo-apple-authentication that may work for you. I have never tried this library, but consider using itm before going through this article’s recommendations.
Firebase React Native library #
In my application I’ve decided to use Firebase to authenticate users. Firebase provides a way to authenticate users using Apple’s Sign in with Apple feature. To enable this feature, you need to configure your app in the Apple Developer Console and Firebase Console.
For React Native there is a cool implementation for Firebase integrations called react-native-firebase. It provides instructions and examples on how to integrate Firebase Authencation with Social Providers like Google, Facebook, Twitter, and Apple, etc.
The library provides detailed instructions on how to configure all social networks authentication providers, but Sign In with Apple require some additional steps to be configured in Xcode. But since I play with Expo, I generate ios
and android
folders automatically, and I don’t want to configure anything manually. Expo should provide a way to configure this automatically as all other parts of the app and the project.
Expo iOS app configuration #
After a couple of ours of research, I’ve found a way to configure Sign in with Apple for Expo iOS app through app configuration (app.json
/app.config.js
/app.cofngi.ts
). Expo’s configuration paramerter has name entitilements
.
Here is an example on how to enable Sign In with Apple in Xcode project for auto-generated Expo iOS app:
{
"ios": {
"entitlements": {
"com.apple.developer.applesignin": ["Default"]
}
}
}
Funny part:
I tried to use different AI chats to get help with this issue, but they all were not able to help me. Regular old-style search engines and GitHub/StackOverflow/Reddit/etc. are still the best way to get help with issues.