invertase/react-native-apple-authentication

After Revoking Apple ID (Stop Using Apple ID) not getting full name and email on next login attempt

michaelbrant opened this issue · 15 comments

The FAQs say that in order to receive the full name and email again, you must revoke Apple ID access for the app. After logging out of the app, revoking Apple ID access (Settings > Apple ID > Sign-In & Security > Sign in with apple > My App > Stop Using Apple ID), and then logging in again, I'm still not seeing full name and email in the response. I was also expecting to be prompted to share/ hide my email address but that didn't pop up either.

Here is the code:

async function signInOrRegisterWithApple() {
  const appleAuthRequestResponse = await appleAuth.performRequest({
    requestedOperation: appleAuth.Operation.LOGIN,
    requestedScopes: [appleAuth.Scope.FULL_NAME, appleAuth.Scope.EMAIL],
  });

  const { identityToken, nonce, email, fullName } = appleAuthRequestResponse;

  if (identityToken) {
    const appleCredential = firebase.auth.AppleAuthProvider.credential(identityToken, nonce);

    const user = await firebase.auth().signInWithCredential(appleCredential);

    console.warn(`These values are empty: ${email} ${fullName?.givenName}`);
  } 
}

Other things I've tried:

  1. Made sure the order of requestedScopes had Full name first
  2. Uninstalled the app and reinstalled + revoke Apple ID access while uninstalled
  3. Posted in Apple Community
  4. I've tried to revoke the token, at first I was getting[Error: [auth/invalid-credential] The supplied auth credential is malformed or has expired.] but realized this was because I was using firebase local auth emulator. After switching to the hosted firebase auth, revokeToken did work successfully, however, the main problem still persists.
async function revokeSignInWithAppleToken() {
  const { authorizationCode } = await appleAuth.performRequest({
    requestedOperation: appleAuth.Operation.REFRESH,
  });

  if (!authorizationCode) {
    throw new Error("Apple Revocation failed - no authorizationCode returned");
  }

  // Revoke the token
  return auth().revokeToken(authorizationCode);
}

Unexpected. Do you have version information of all the components of the system under test (device model number, device operating system, relevant package versions from package.json, xcode version etc)? https://stackoverflow.com/help/how-to-ask

The FAQ you list was developed via experience / test results from users of the library. I personally did not do the testing or observe the results so I don't have the experience to say if it used to work correctly or not. I also do not have time to do the testing now, with apologies.

I'm open to any PR either updating documentation or altering code as needed depending on what you learn via testing and/or any responses you get from the Apple discussions

any update on this?