Retrieve random created email

Hi Developers,


Let's imagine there's an app need to store the email of the user who signs in with Apple for later communication. What happens If they decided not to share their email.


According to Apple's documentation, a unique, random email address is created. The app will use this email as a proxy if it wants to send an email to the user.


How can the developer retrieve this email, since if the user hides their email, there will be nil returned on email property?


If anyone have experimented on this matter, please enlighten me with the approaches.

Thanks in advanced.

Accepted Reply

Hi Alfie,

If you request an email address when signing in with Sign in with Apple.

The first time a user creates an account with you, the user will be prompted to either share their real email address, or hide it (which will create a unique, random email address so that you can comunicate with the user, without the user sharing his real email address.


This random email address will be returned on the email property of the credential.


It is important to note that this will only be retreived to you the first time the user signs in to your application, all subsequent login attempts will only return the User identifier to the app and not the email address or name.

Replies

Hi Alfie,

If you request an email address when signing in with Sign in with Apple.

The first time a user creates an account with you, the user will be prompted to either share their real email address, or hide it (which will create a unique, random email address so that you can comunicate with the user, without the user sharing his real email address.


This random email address will be returned on the email property of the credential.


It is important to note that this will only be retreived to you the first time the user signs in to your application, all subsequent login attempts will only return the User identifier to the app and not the email address or name.

Hi @alfonsotapia, thanks for answering.


This is the point: It is important to note that this will only be retrieved to you the first time the user signs in to your application, all subsequent login attempts will only return the User identifier to the app and not the email address or name.


I've checked with my new apple id in the app, and the private relay email is returned for the first time only, in the email property of credential.


This answer solves my issue.

Thank you very much.



I've been working on implementing Sign in with Apple in my team about a month ago and email property in the identityToken was ALWAYS present for every sign in attempt on all tested AppleID accounts. Yesterday we started experiencing a missing email property with random users. Meanwhile we implemented SIWA in that way that we always expect the email property to be inside of the identityToken. What now?
I think I solved the issue in my project. It turned out that someone on the team used SIWA without defining the scope and every Apple account which used his version for the first time, would forever receive id_token's without email cause once you agree on a scope with the user, you stick with it forever. You can't extend the scope on next sign in. Only if user disconnects and reconnects his/hers Apple account with your app.