getAppleCredential method
Implementation
@override
Future<Either<AuthFailure, OAuthCredential?>> getAppleCredential() async {
final rawNonce = generateNonce();
final nonce = _sha256ofString(rawNonce);
late AuthorizationCredentialAppleID appleIdCredential;
try {
appleIdCredential = await SignInWithApple.getAppleIDCredential(
nonce: nonce,
scopes: [
AppleIDAuthorizationScopes.email,
AppleIDAuthorizationScopes.fullName,
],
);
} catch (exception, stackTrace) {
return left(_resolveException(
exception: exception,
stackTrace: stackTrace,
locale: 'getCurrentUser',
sigInType: SigInType.phone));
}
return Right(OAuthProvider('apple.com').credential(
rawNonce: rawNonce,
idToken: appleIdCredential.identityToken,
));
}