Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting just the private email #49

Open
tamirrab opened this issue Jul 4, 2020 · 0 comments
Open

Getting just the private email #49

tamirrab opened this issue Jul 4, 2020 · 0 comments

Comments

@tamirrab
Copy link

tamirrab commented Jul 4, 2020

I need to get the real email to connect with my user, but I’m getting only the private email even if I selecting the real email

Code:

  try {
    final AuthorizationResult result = await AppleSignIn.performRequests([
      AppleIdRequest(requestedScopes: [Scope.email])
    ]);

    switch (result.status) {
      case AuthorizationStatus.authorized:
        AppleIdCredential appleCredential = result.credential;

        OAuthProvider oAuthProvider =
            new OAuthProvider(providerId: "apple.com");
        final AuthCredential credential = oAuthProvider.getCredential(
          idToken: String.fromCharCodes(appleCredential.identityToken),
          accessToken: String.fromCharCodes(appleCredential.authorizationCode),
        );

        AuthResult authResult = await _auth.signInWithCredential(credential);

        user = authResult.user;

        await _getUserByEmail(context, user.email);
        break;

      case AuthorizationStatus.error:
        print("Sign in failed: ${result.error.localizedDescription}");
        break;

      case AuthorizationStatus.cancelled:
        print('User cancelled');
        break;
    }
  } catch (e) {
    PlatformException error = e;
    debugPrint(" bug tamir: ${error.message}");
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant