Cannot get email & name while scopes requested on real device

So I'm implementing sign in with Apple, requesting `email` and `fullName` scopes

It works on simulator, when authenticating, the name and email UI shows as expected, as this image shows:


https://i.imgur.com/BPFfoRR.png


this is testing on the simulator, but when I move to real device (iPadOS 13), the UI does not shows, as this image shows:


https://i.imgur.com/pbhTRzj.png


and also the result only returns the user identifier:


https://i.imgur.com/17rIEGX.png


and I can confirm that the `authorizedScopes` from `ASAuthorizationAppleIDCredential` is also empty.


I believe this is a bug, if it's not, can somebody tell me how to fix this?


Thanks!

Accepted Reply

Hi aslkdjalksdjasdasd,

This behaves correctly, user info is only sent in the ASAuthorizationAppleIDCredential upon initial user sign up. Subsequent logins to your app using Sign In with Apple with the same account do not share any user info and will only return a user identifier in the ASAuthorizationAppleIDCredential. It is recommened that you securely cache the initial ASAuthorizationAppleIDCredential containing the user info until you can validate that an account has succesfully been created on your server.


- Patrick

  • When I was testing, I encountered a server problem for the first registration, so there was no data on the server, but I couldn't get the name and email after registering again. How can I go back to the first registration.

  • Hello ZhuHaoyu,

    This is possible to go back to the first registration behavior. To do this, login with the apple account on https://appleid.apple.com/account/manage. Then go to "sign in and security" > "sign in with apple". A popup appears showing apps and website where apple sign-in is used. Clic on the app of your choice and then on "stop using sign in with apple".

    ma.coutanceau
  • This is so wrong, there are so many scenarios that would need the userInfo again, i understand this is a security decision but this should be rethink for usability, getting the username and email shouldn't be an issue.

Replies

Hello guys,

I just got here with the same problem.

The email from user only returns in the first sign in.
My workaround was to save locally in the device (app space) this data.

My new problem is, after user remove my app, and reinstall it, all data I saved is lost, but the device still "think" the user is authenticated. If I try to do sign in with apple, all tries will have not the email information. It always come null.

To be able to sign-in in a re-installed app, the developer must to go to settings firrst and removing the data linked to the app, because when we uninstall the app, this credentials remain in the device.

There is any way to force the system to remove sign in data after uninstall the app?

Tahnk you


The answer implies that we can get the credenital only one time (First name and last name) and it should be stored or cached. Let's say, we could not store it for some reason, how do I get it again? If there is no way to get the info on a real device, it's really bad thing and disappointed about this implementation. If I'm getting it wrong, please guide me towards the right direction.
This is terrible design. Even if the user deletes the app, and reinstalls, the app still does not get the email. How am I supposed to cache the email if the user just deleted the app?

You might ask, why is someone deleting the app and reinstalling it? Why because they are the app review team, and they keep denying your app because login with apple doesn't work!


  • Open https://appleid.apple.com/account/manage

    Click on "Manage apps & websites apps & websites using Apple ID"

    Click on the name of your app which is listed

    Click on "Stop using apple id"

    Confirm

    Your appleid is detached from your app Simply remove your app from the device and reinstall

    You will get a fresh new "Sign in with apple" experience and have the first call back to you!

     

  • First of all It does not work and secondly you simply cannot ask your users your users to do that if for example, at some point they uninstalled your app which removed the cached email. This is not an acceptable solution.

Add a Comment
Patrick, if that's the expected behavior, then how are we supposed to test user registration on web (JS)? What if my server implementation had a bug and I have to redo it? Should I create sandbox users and enable 2fa for each of them every time? This is a very long and cumbersome process. Is there a way to delete/rest the profile somehow so I can register again as if it was my first time?
Apple does not provide a /userinfo call like every other oAuth implementation I can think of... Providing the /userinfo call would solve the issue. You need to make this call to ensure the token is still valid from time to time. Also most other oAuth implementations provide a picture as well.

Even if you delete the app and run it again, you can't have access to the familyName, givenName, email, etc. It truly is given to you ONE time.

My team noticed this problem early, and even though we only launched in specific locations, we started saving information into keychain of people who were out of location.

A way to test if your auth stuff works is to run your auth code on a phone you haven't plugged into simulator yet.

To get the email and name again as if you have never used Apple signin for the App, go to Settings > Click your Name > Password & Security > Apps Using Apple ID > Click the name/description of your App > Click Stop Using Apple ID. Then you should be able to sign-in again with full information supplied.