I'm building the Apple Sign In using React Native in an Expo project. I'd like to link the user to a firebase user however, I am getting the above error.
I have my Apple Sign In Key within the keys section on the Apple Developer Account.
I have added the
"expo-apple-authentication"
plugin to myapp.json
as per the below{ ... "plugins": [ [ "expo-apple-authentication", [ "@stripe/stripe-react-native", { "merchantIdentifier": "XXXXXXXXXXXXXXXXXXXX", "enableGooglePay": false } ] ] ] }
Here's the code
const createUserWithApple = async () => {
try {
const credential = await AppleAuthentication.signInAsync({
requestedScopes: [
AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
AppleAuthentication.AppleAuthenticationScope.EMAIL,
],
});
const { identityToken } = credential;
if (identityToken) {
console.log("ID TOKEN:", identityToken); // I AM GETTING TOKEN HERE YAY!
const provider = new OAuthProvider("apple.com");
provider.addScope("email");
provider.addScope("name");
const providerCredential = provider.credential({ identityToken });
const result = await signInWithCredential(
FIREBASE_AUTH,
providerCredential
);
console.log("GOT RESULT:", result);
}
} catch (error) {
console.log("CAUGHT ERROR:", error);
}
};
I'm not sure if I have my Service ID correct in the Firebase Console though. It appears to be my {MY_TEAM_ID.MY_BUNDLE_IDENTIFIER}
SOLVED
Change:
To: