Please provide the following:
- SDK Version: 36.0.0
- Platforms(Android/iOS/web/all): Ios
Hello,
I have implemented Apple Sign In in my expo managed app with firebase.
It was all working perfectly and had been deployed to the app store successfully.
I have followed these steps Adding Sign In With Apple to a managed Expo app using Firebase Authentication | by Dan Singer | Medium from
31284
A couple of days later I submitted a new build, without changing anything in the apple signIn logic to my knowledge.
Now I get the following error on the new TestFlight build or in Expo: “credential failed: First argument “idToken” must be a valid string or null”, although I can log the idToken properly which is a string as it is supposed to be.
I have tried:
-
uninstalling and reinstalling node modules and run again
expo install expo-apple-authentication -
delete my app from my apple id manager, and try sign in again
-
I have tried with and without the “nonce” value
The Apple Sign in is still working in the public App Store build.
Could this be because of multiple builds co existing maybe ?
Thank you !
My Apple SignIn code :
renderAppleLoginButton = () => {
if (this.state.available === true) {
return (
<AppleAuthentication.AppleAuthenticationButton
buttonType={AppleAuthentication.AppleAuthenticationButtonType.SIGN_IN}
buttonStyle={AppleAuthentication.AppleAuthenticationButtonStyle.BLACK}
cornerRadius={5}
style={{ width: 250, height: 50 }}
onPress={async () => {
try {
const csrf = Math.random().toString(36).substring(2, 15);
const appleCredential = await AppleAuthentication.signInAsync({
requestedScopes: [
AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
AppleAuthentication.AppleAuthenticationScope.EMAIL,
],
state: csrf,
});
let { identityToken, email, state } = appleCredential
if (identityToken) {
console.log('identityToken', identityToken)
const provider = new firebase.auth.OAuthProvider("apple.com");
console.log('provider', provider)
const credential = provider.credential({
idToken: identityToken,
})
console.log('credential', credential)
**// HERE CREDENTIAL DOES NOT LOG**
const {uid} = await this.authenticateApple(credential)
this.createUserApple(uid, email)
}
// signed in
} catch (e) {
if (e.code === 'ERR_CANCELED') {
} else {
// handle other errors
this.setState({error: e.message})
}
}
}}
/>
);
}
}