0Pricing
Firebase Auth & Realtime Database Apps · Lektion

Apple-Sign-In-Integration

Fügen Sie Ihrer Firebase-App Sign in with Apple hinzu, erfüllen Sie Apples App-Store-Anforderung für Social Logins und verarbeiten Sie Apples datenschutzorientiertes E-Mail-Relay korrekt.

Apple-Sign-In-Integration ist eine kostenlose Firebase Auth & Realtime Database Apps-Lektion auf CoddyKit. Dies ist Lektion 4 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Firebase Auth & Realtime Database Apps-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Firebase Auth & Realtime Database Apps-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

Why Apple Sign-In

If your iOS app offers any third-party social login (Google, Facebook, etc.), Apple's App Store guidelines require you to also offer Sign in with Apple. Beyond compliance, it is a fast, privacy-respecting option users trust.

How It Differs

Apple Sign-In has unique traits compared to other providers:

  • Users can hide their real email via a private relay address
  • Name and email are only returned on the first sign-in
  • Requires an Apple Developer account to configure

Enabling the Provider

In the Firebase console open Authentication > Sign-in method and enable Apple. For web you must also supply your Apple Service ID, Team ID, Key ID, and a private key generated in the Apple Developer portal.

Configuring the OAuth Provider

On the web you use Firebase's OAuthProvider with the Apple provider ID and request the scopes you need.

import { OAuthProvider } from 'firebase/auth';

const provider = new OAuthProvider('apple.com');
provider.addScope('email');
provider.addScope('name');

Triggering the Sign-In

Use signInWithPopup (or redirect on mobile web) to launch the Apple flow and receive a Firebase user.

import { getAuth, signInWithPopup } from 'firebase/auth';

const result = await signInWithPopup(getAuth(), provider);
const user = result.user;
console.log('Signed in as', user.uid);

Capturing Name on First Sign-In

Apple sends the user's full name only once, on the very first authorization. Persist it immediately, because subsequent sign-ins will not include it.

const credential = OAuthProvider.credentialFromResult(result);
const fullName = result._tokenResponse?.displayName;
if (fullName) saveProfileName(user.uid, fullName);

The Private Email Relay

If a user chooses to hide their email, Apple returns a relay address like abc123@privaterelay.appleid.com. Email sent to it is forwarded to the user.

  • Treat it as a valid, stable email
  • Do not require the 'real' address

Account Linking

A user may sign in with Apple after previously using email/password with the same address. Use Firebase account linking to merge identities into a single account rather than creating duplicates.

import { linkWithCredential } from 'firebase/auth';

const cred = OAuthProvider.credentialFromResult(result);
await linkWithCredential(existingUser, cred);

Native iOS Considerations

In a native iOS app you generate a nonce and pass Apple's identity token plus that nonce to Firebase. The nonce protects against replay attacks and is required by Firebase for native Apple credentials.

Handling Cancellation

Users can dismiss the Apple sheet. This surfaces as an error you should treat as a silent no-op, not a failure to display loudly.

try {
  await signInWithPopup(getAuth(), provider);
} catch (e) {
  if (e.code === 'auth/popup-closed-by-user') return;
  showError('Sign-in failed, please try again.');
}

Testing and Review

Apple reviewers actively check that Sign in with Apple is offered when other social logins exist. Test the full flow, including the hide-email path, before submitting your app for review.

Quick Check

Test your understanding of Apple Sign-In.

Recap

You can now add Apple Sign-In correctly.

  • Required when other social logins are offered on iOS
  • Configure the provider with Service/Team/Key IDs
  • Capture the name on first sign-in only
  • Support the private email relay
  • Use nonces natively and link duplicate accounts

Häufig gestellte Fragen

Ist die Lektion „Apple-Sign-In-Integration“ kostenlos?

Ja — der vollständige Text von „Apple-Sign-In-Integration“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Firebase Auth & Realtime Database Apps-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Firebase Auth & Realtime Database Apps-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Apple-Sign-In-Integration“?

Fügen Sie Ihrer Firebase-App Sign in with Apple hinzu, erfüllen Sie Apples App-Store-Anforderung für Social Logins und verarbeiten Sie Apples datenschutzorientiertes E-Mail-Relay korrekt. Du übst Firebase Auth & Realtime Database Apps mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um Firebase Auth & Realtime Database Apps zu starten?

Keine Vorkenntnisse erforderlich. Firebase Auth & Realtime Database Apps auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 4 von 4.

Wie lange dauert die Lektion „Apple-Sign-In-Integration“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser Firebase Auth & Realtime Database Apps-Lektion Code schreiben und ausführen?

Ja. Jede Firebase Auth & Realtime Database Apps-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Google Sign-In integrieren
  2. Facebook- und GitHub-Authentifizierung
  3. Anonyme und benutzerdefinierte Authentifizierung
  4. Apple-Sign-In-Integration
← Zurück zu Firebase Auth & Realtime Database Apps