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

bug: SignInwithApple returns displayName null for first connexion #417

Closed
6 of 13 tasks
ludonoel1 opened this issue Aug 2, 2023 · 17 comments
Closed
6 of 13 tasks

bug: SignInwithApple returns displayName null for first connexion #417

ludonoel1 opened this issue Aug 2, 2023 · 17 comments

Comments

@ludonoel1
Copy link

Plugin(s)

  • Analytics
  • App
  • App Check
  • Authentication
  • Crashlytics
  • Cloud Messaging
  • Performance
  • Remote Config

Did you test the latest version?

  • I use the latest version

Platform(s)

  • Android
  • iOS
  • Web

Current behavior

This is my code :

return FirebaseAuthentication.signInWithApple({ skipNativeAuth: true, scopes: ["name", "email"] }).then((result: SignInResult) => {
          const provider = new OAuthProvider('apple.com')
          const authCredential = provider.credential({
            idToken: result.credential.idToken,
            rawNonce: result.credential.nonce,
          });
         return signInWithCredential(getAuth(), authCredential)
.then((result: UserCredential) => {console.log(result.displayName}

Problem is that displayName null for new account...

I remove account in firebase console after every registration.

Expected behavior

I'm expecting to get displayName of Apple account where I can find firstname and lastname.

Reproduction

none

Steps to reproduce

Just run this code

Other information

No response

Capacitor doctor

@capacitor/cli: 5.2.2
@capacitor/core: 5.2.2
@capacitor/android: 5.2.2
@capacitor/ios: 5.2.2

Installed Dependencies:

@capacitor/cli: 5.0.5
@capacitor/core: 5.0.5
@capacitor/android: 5.0.5
@capacitor/ios: 5.0.5

Before submitting

  • I understand that incomplete issues (e.g. without reproduction) are closed.
@ludonoel1 ludonoel1 added bug/fix Something isn't working needs: triage labels Aug 2, 2023
@robingenz
Copy link
Member

Apple provides the display name only once at signup.
Make sure you delete the Firebase user entry AND revoke the Apple ID access correctly.

@ludonoel1
Copy link
Author

I did it ...

@robingenz
Copy link
Member

Okay, I will take a closer look at it as soon as possible.

@ludonoel1
Copy link
Author

Thanks. Do you have a working example maybe ? please, because it's urgent

@ludonoel1
Copy link
Author

With version 5.1.0 it's working on Web but not for ios simulator

@robingenz
Copy link
Member

It should work with the demo app. But the demo app does not use skipNativeAuth. So I don't know if it will help you.

There are currently a few open issues that I need to work through. If you want you can have your issue prioritized via a one-time sponsorship. Otherwise PRs are also welcome.

@ludonoel1
Copy link
Author

ludonoel1 commented Aug 3, 2023

Finally I use this code:

let options: SignInWithAppleOptions = {
                clientId: 'cclientID', //
                redirectURI: 'handler', //
                scopes: 'email name',
              };
              
              return SignInWithApple.authorize(options)
                .then((result: SignInWithAppleResponse) => {
                  const provider = new OAuthProvider('apple.com')
                  const authCredential = provider.credential({
                    idToken: result.response.identityToken,
                  });
    const displayName = `${result.response.givenName} ${result.response.familyName}`
                 return signInWithCredential(getAuth(), authCredential)

Issue is that signInWithCredential doesn't return displayName. DisplayName is still null

@robingenz
Copy link
Member

I am glad you found a workaround.
Does this problem occur on all 3 platforms? Or on which platforms did you test it?

@ludonoel1
Copy link
Author

I use this above code for android and IOS,

and your code for Web

@robingenz
Copy link
Member

I mean on which platforms does the bug with the @capacitor-firebase/authentication plugin occur? I have to debug it.

@ludonoel1
Copy link
Author

On Ios and android. Sorry

@robingenz
Copy link
Member

Oh, so you mean on Android & iOS?

@ludonoel1
Copy link
Author

Yes :)

@robingenz
Copy link
Member

Thanks 👍

@robingenz
Copy link
Member

I just tested it and cannot reproduce your issue. When I delete the Firebase user entry and revoke the Apple ID access, the next time I sign in I get the display name.

grafik

@robingenz
Copy link
Member

@ludonoel1 This might help you: #481 (comment)

Copy link
Contributor

github-actions bot commented Dec 4, 2023

It looks like there hasn't been a reply in 30 days, so I'm closing this issue.

@github-actions github-actions bot closed this as completed Dec 4, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants