signInWithApple static method

Future<void> signInWithApple(
  1. BuildContext context
)

Implementation

static Future<void> signInWithApple(BuildContext context) async {
  late UserCredential c;
  String rawNonce = _generateNonce();
  String nonce = _sha256ofString(rawNonce);
  asi.AuthorizationCredentialAppleID appleCredential =
      await asi.SignInWithApple.getAppleIDCredential(
    scopes: [
      asi.AppleIDAuthorizationScopes.email,
      asi.AppleIDAuthorizationScopes.fullName,
    ],
    nonce: nonce,
  );
  svc<AuthService>().addUsernameHint(ArcaneAuthUserNameHint(
      firstName: appleCredential.givenName,
      lastName: appleCredential.familyName));

  await svc<AuthService>().signIn(OAuthProvider("apple.com").credential(
    idToken: appleCredential.identityToken,
    rawNonce: rawNonce,
    accessToken: appleCredential.authorizationCode,
  ));
}