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

[sign_in_with_apple] Getting just the private email #107

Closed
tamirrab opened this issue Jul 3, 2020 · 4 comments
Closed

[sign_in_with_apple] Getting just the private email #107

tamirrab opened this issue Jul 3, 2020 · 4 comments
Labels
package:sign_in_with_apple question Further information is requested

Comments

@tamirrab
Copy link

tamirrab commented Jul 3, 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

@HenriBeck HenriBeck added package:sign_in_with_apple question Further information is requested labels Jul 3, 2020
@HenriBeck HenriBeck changed the title Getting just the private email [sign_in_with_apple] Getting just the private email Jul 3, 2020
@HenriBeck
Copy link
Member

@tamirrab I just checked and the code works as expected and I get my correct email.

Could you please elaborate on your exact problem and share some of the code you are using?

@tamirrab
Copy link
Author

tamirrab commented Jul 3, 2020

This is my code,
For some reason I never get the real email:

My code:

  FirebaseUser user;
  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}");
  }
}

@HenriBeck
Copy link
Member

You are not using our library. Either please switch to our library and see if it then works, or file an issue at correct Github Repository.

Therefore I'm closing this issue for now.

@tp
Copy link
Collaborator

tp commented Jul 4, 2020

For reference the new issue is here tomgilder/flutter_apple_sign_in#49

@tamirrab If that issue can't be resolved, I encourage you to try this package, there is also some information on how to integrate with Firebase, so that's definitely something that is working for many people.

Might it be that the e-mail is never updated after any one has been associated with the app? Then you could try to disassociate the app under the Apple ID settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:sign_in_with_apple question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants