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!

Answered by Frameworks Engineer in 379297022

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

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!


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.

I tried really hard to get this to work just for debugging. I deleted the app on simulators, deleted my app from the "Apps Using Apple ID" area, and none of it worked (as someone above did say). What I ended up doing that is a hack, but worked, was that I removed the app from "Apps Using Apple ID", then I just tested it on one of the other Apple Simulator devices that I don't normally use. It only works a few times because of the limited simulators, but it did get me by this issue for now. Would love to find a real way to do this.

I followed this thread to get back the email and name as if it was the first login and worked for some time. Now testing on an iPhone 15 emulator with iOS 17.0 and not working anymore. What worked for me was to unsign the apple ID from the emulator, try the apple login within your app and follow the phone suggestion to sign in apple id in phone settings. After completing the process and getting back on the app, the call correctly returns email, name and surname and the emulator shows the choice between clear or masked email again.

Cannot get email & name while scopes requested on real device
 
 
Q