patelmayankce / react-apple-login

A Apple Log-in Component for React
MIT License
65 stars 21 forks source link

don't response with the users data #21

Closed olongino closed 3 years ago

olongino commented 3 years ago

Hi I have a event with the library so when use and do login with apple I don't recive the user email and data name and lastName, can your help me if the implementation is correct or there is a issue, this is my code

<AppleLogin
    clientId={intl.get('HOME_APPLE_LOGIN_API_KEY')}
    redirectURI={intl.get('HOME_APPLE_LOGIN_REDIRECT_TO')}
    scope={"email"}
    responseType={"id_token"}
    responseMode={"form_post"}
    usePopup={true}
    callback={this.responseAppleLogin}
/>

The library only response with:

{
authorization:{
  code: xxxxxxxx,
  id_token:  xxxxxxxx
}
}

But in the documentation say that response is with tha user data: email, name and lastname

GoBig87 commented 3 years ago

I had this issue too. What happened was I signed into my app with out the scope set the first time. I then added the scope later and could never get the email of my account. It turns out the first time you sign in, you keep the scope of the initial sign in. To fix this I had to logout/forget my app and sign in again as a first time user with the scope set to email. After this I was able to get my user data. This might be a user setting issue rather and issue with the code.

aryanm5 commented 3 years ago

@olongino Apple Sign In only returns the user data (email, name) the first time a user signs into your app with Apple. After that, no user data is provided. I would recommend storing the user info in localStorage or somewhere so that it can be accessed later if needed.

AbanoubEMhanna commented 3 years ago

i have same problem !!

patelmayankce commented 3 years ago

@aryanm5 @AbanoubEMhanna This is how apple works,

Apple gives data only first time, then you have to save those data in DB along with id_token/code so next time when you have id_token you can identify the user and do login.

Ref: https://developer.apple.com/forums/thread/119826