I am trying to implement apple sign with flutter. I am getting all the values as null. First Time I got name and email id but got auth_id and id_token as null. Second time all the values came null like. AuthorizationAppleID(null, null, null, null, null)
_applelogin() async {
provider = 'apple';
final credential = await SignInWithApple.getAppleIDCredential(
scopes: [
AppleIDAuthorizationScopes.email,
AppleIDAuthorizationScopes.fullName
],
webAuthenticationOptions: WebAuthenticationOptions(
clientId: 'com.example.com',
redirectUri: Uri.parse('https://My-Project.glitch.me/callbacks/sign_in_with_apple'),
),
);
print(credential);
}
Solution 1: JD Kim
I solved this problem.
Check your server credential(.p8, PRIVATE KEY) file which is private key.
you can check 'authorizationCode','identityToken' than use like this code.
final oauthCredential = OAuthProvider("apple.com").credential(
idToken: credential.identityToken,
accessToken: credential.authorizationCode);
// Sign in the user with Firebase. If the nonce we generated earlier does
// not match the nonce in `appleCredential.identityToken`, sign in will fail.
final user = await FirebaseAuth.instance.signInWithCredential(oauthCredential);