Delete Account for Sign in with Apple in React Native with Firebase

285 views Asked by At

I am trying to implement Sign in with Apple in my React Native project with firebase, and am following these docs: https://rnfirebase.io/auth/social-auth which refers to this library: https://github.com/invertase/react-native-apple-authentication.

The docs mention the account deletion should include revoking the Sign in with Apple token, for which they have given this sample code:

import auth from '@react-native-firebase/auth';
import { appleAuth } from '@invertase/react-native-apple-authentication';

async function revokeSignInWithAppleToken() {
  // Get an authorizationCode from Apple
  const { authorizationCode } = await appleAuth.performRequest({
    requestedOperation: appleAuth.Operation.REFRESH,
  });

  // Ensure Apple returned an authorizationCode
  if (!authorizationCode) {
    throw new Error('Apple Revocation failed - no authorizationCode returned');
  }

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

The 'revokeToken' function used in the last line is not a function defined in the library. I'm not sure why it is mentioned in the docs and used in the sample code. Has anybody found a solution that doesn't require setting up a server. I have read through the github issue: https://github.com/invertase/react-native-apple-authentication/issues/282 and it doesn't seem to conclude to a concrete solution, even though the docs on the firebase social auth website seem to have. Am I missing anything? How can I implement the revokeToken to complete the apple sign in account deletion?

0

There are 0 answers