I'm trying to implement Apple Sign In with firebase's v9 modular signInWithCredential function.
I've been following the documentation on both firebase & apple side but keep getting the following error when I try to run signInWithCredential:
[TypeError: undefined is not an object (evaluating 'credential._getIdTokenResponse')]
I am able to get the Apple Sign In to pop-up & use a biometric to authenticate. This then gives me an identityToken that I've verified on jwt.io. It's only at signInWithCredentials where it throws an error.
Can anyone see what I'm doing wrong?
const appleCredential = await AppleAuthentication.signInAsync({
requestedScopes: [
AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
AppleAuthentication.AppleAuthenticationScope.EMAIL
],
state: csrf,
nonce: hashedNonce
});
const { identityToken, authorizationCode } = appleCredential;
if (identityToken) {
const authCredential = new OAuthProvider(
"apple.com"
).credential({
idToken: identityToken,
accessToken: authorizationCode,
rawNonce: nonce // nonce value from above
});
signInWithCredential(authCredential)
.then((credential) => {
console.log(credential?.providerId)
}).catch(e => { console.log("error in apple auth: ", e) })
}