Sign in with Apple is usually the fastest login on iOS, and for many apps it is not optional. This guide covers the Apple Developer setup, the Firebase console, the Flutter code, and the two details that cause most bugs and rejections: the missing name and token revocation on account deletion.
When Apple requires it
Apple’s guideline 4.8 says an app that uses a third-party or social login for the user’s primary account “must also offer as an equivalent option another login service with the following features”:
- “the login service limits data collection to the user’s name and email address;”
- “the login service allows users to keep their email address private as part of setting up their account; and”
- “the login service does not collect interactions with your app for advertising purposes without consent.”
Sign in with Apple meets all three. Exceptions include an app that “exclusively uses your company’s own account setup and sign-in systems.” See guideline 4.8.
1. Set up Apple
Firebase’s Apple guide notes that “Sign In with Apple can only be configured by members of the Apple Developer Program.” Then:
- Enable the capability. Turn on Sign in with Apple for your App ID on the Certificates, Identifiers & Profiles page, and add the “Sign in with Apple” capability to the
Runnertarget in Xcode. - Create a Services ID if you also support Android or web, and register the return URL
https://YOUR_FIREBASE_PROJECT_ID.firebaseapp.com/__/auth/handler. - Create a private key for Sign in with Apple and note the key ID.
- Configure the email relay if Firebase sends email to users (verification, email links): register
noreply@YOUR_FIREBASE_PROJECT_ID.firebaseapp.comwith Apple’s private email relay.
2. Set up Firebase
In the Firebase console, open Authentication, then Sign-in method, and enable Apple. Enter the Services ID, and under the OAuth code flow configuration enter your Apple Team ID, the private key and the key ID. The code flow settings are also what make token revocation work later.
3. The Flutter code
Firebase’s FlutterFire docs show the provider flow:
import 'package:firebase_auth/firebase_auth.dart';
Future<UserCredential> signInWithApple() async {
final appleProvider = AppleAuthProvider();
if (kIsWeb) {
return FirebaseAuth.instance.signInWithPopup(appleProvider);
}
return FirebaseAuth.instance.signInWithProvider(appleProvider);
}
The docs’ version omits the return; the version above returns the credential. For a native sheet with more control, Firebase points to the sign_in_with_apple package, which describes itself as a “Flutter bridge to initiate Sign in with Apple (on iOS, macOS, and Android),” and then AppleAuthProvider.credentialWithIDToken(idToken, rawNonce, fullName).
Handle the cancelled case quietly: if the user closes the sheet, return to the login screen without an error.
4. Save the name on first sign-in
“Apple only shares user information such as the display name with apps the first time a user signs in.” If you miss it, you will not get it again. On the first successful sign-in, write the name to the Firebase user profile or your user document straight away. Firebase also warns that if a user previously signed in with Apple without Firebase, Apple will not give Firebase the name.
Users may hide their email. Those addresses end in privaterelay.appleid.com. Treat them as normal addresses and do not ask users to reveal the real one.
5. Revoke the token on account deletion
Apple requires in-app account deletion for apps that create accounts. Firebase’s Apple guide adds the Sign in with Apple step: because Firebase does not store the Apple tokens, ask the user to sign in with Apple again, take the authorization code, revoke, then delete. In Flutter:
final credential = await FirebaseAuth.instance.signInWithProvider(AppleAuthProvider());
final authCode = credential.additionalUserInfo?.authorizationCode;
if (authCode != null) {
await FirebaseAuth.instance.revokeTokenWithAuthorizationCode(authCode);
}
await FirebaseAuth.instance.currentUser?.delete();
Also delete the user’s data on your backend. See guideline 5.1.1.
6. Android
The sign_in_with_apple package supports Android through a browser flow. Its README says the app “must use launchMode singleTask or singleTop,” needs a callback activity in the manifest, and that “the Service ID is only needed for a Web or Android integration.” Many apps simply show Sign in with Apple on iOS only and Google Sign-In on Android, which Apple’s rule allows.
Test checklist
- First sign-in saves the name
- Second sign-in works with no name
- Hide My Email works and emails arrive
- Cancel returns quietly
- Account deletion revokes the token and removes data
- The button follows Apple’s style rules and is as prominent as other login buttons
Claude Code can write all of this, but the Apple and Firebase console steps are yours. See Firebase and Flutter with Claude Code and Build a Flutter app with Claude Code.
Sources read on the day this post was written: Firebase: federated identity and social sign-in in Flutter, Firebase: authenticate using Apple on Apple platforms, Apple App Review Guidelines and sign_in_with_apple on pub.dev.