Issue with Missing Email on Apple Login in Parse iOS SDK

Content:

I’m working on an iOS application that uses Apple Login with Parse and have encountered an issue I need help understanding and resolving.

Here’s a detailed explanation of the problem:

  1. Behavior with logInWithAuthType:
  • The first time a user logs in with Apple using logInWithAuthType, Apple provides the email and name that we persist in the user object with “pin”
  • However, for all subsequent logins using the same Apple ID, Apple does not provide the email or name again. This is expected behavior from Apple.
  1. The Problem with Deleted App and Reinstall:
  • If I delete the app and reinstall it, Apple attempts to log in, but Parse returns an error stating that the email is missing.
  • This happens even though we only pass authData in the logInWithAuthType call.
  • I do not understand how Parse knows that the email is missing, given that we do not explicitly pass the email in this call.
  1. User Data Pinning:
  • We pin the user locally to retain user parameters such as the email and name. However, once the app is deleted and reinstalled, this data is no longer available locally.
  • It seems like the Parse server does not retain the previously provided email for that authData.

My Questions for the Community:

  1. How does Parse determine that the email is missing when using logInWithAuthType, given that we only pass authData and not the email itself?
  2. Is it expected behavior for Parse to reject a login with missing email after a reinstall, even though Apple no longer provides the email?
  3. How can we handle this situation so that users can log in seamlessly after reinstalling the app? Could you provide example code?
  4. Are there any best practices or solutions within the Parse iOS SDK for dealing with Apple’s behavior of not returning email after the first login?

Any insights, documentation pointers, or alternative approaches would be greatly appreciated!