Skip to content

Latest commit

 

History

History
39 lines (33 loc) · 1.11 KB

CONFIGURE_FLUTTER.md

File metadata and controls

39 lines (33 loc) · 1.11 KB

Use SignInWithApple to get an AppleIdCredential:

final appleIdCredential = SignInWithApple.getAppleIDCredential(
    scopes: [
        AppleIDAuthorizationScopes.email,
        AppleIDAuthorizationScopes.fullName,
    ]);

For Android/Web config, also use the (previously created) Service Id and Redirect Uri, with webAuthenticationOptions:

final appleIdCredential = SignInWithApple.getAppleIDCredential(
    scopes: [
        AppleIDAuthorizationScopes.email,
        AppleIDAuthorizationScopes.fullName,
    ],
    webAuthenticationOptions: WebAuthenticationOptions(
        clientId: '[APPLE_SERVICE_ID]',
            redirectUri: Uri.parse(
            '[SERVER_REDIRECT_URL]',
        ),
    ),
);

Use the AppleIdCredential to sign in with Firebase.

// Convert to OAuthCredential.
final oAuthCredential = OAuthProvider('apple.com').credential(
    idToken: appleIdCredential.identityToken,
    accessToken: appleIdCredential.authorizationCode,
);

// Use the OAuthCredential to sign in to Firebase.
final userCredential = await FirebaseAuth.instance.signInWithCredential(oAuthCredential);