I have an expo app on the managed workflow, but not on Expo Go, I use development builds. I have implemented sign-in with Google which works perfectly. In order to comply with Apple’s requirements, I need to also add sign-in with Apple, but it isn’t working. I added the plugin to app.json, rebuilt the app, installed it on the simulator, but when I click the sign-in with Apple button, nothing happens and it logs an error: The authorization attempt failed for an unknown reason. I have read documentations and other questions but nothing seems to solve my problem. Here’s my code for it.
export default function SignIn() {
const { signIn, signOut } = useAuthTools() as AuthOptions;
const [isSignWithAppleAvailable, setIsSignWithAppleAvailable] =
useState<boolean>(false);
useEffect(() => {
(async () => {
const isAvailable = await AppleAuthentication.isAvailableAsync();
setIsSignWithAppleAvailable(isAvailable);
})();
}, []);
const appleLogin = async () => {
try {
const credential = await AppleAuthentication.signInAsync({
requestedScopes: [
AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
AppleAuthentication.AppleAuthenticationScope.EMAIL,
],
});
} catch (e: any) {
console.log(e);
}
};
return (
<>
<Stack.Screen options={{ headerShown: false }} />
<SafeAreaView style={styles.container}>
{isSignWithAppleAvailable && (
<AppleAuthentication.AppleAuthenticationButton
buttonType={
AppleAuthentication.AppleAuthenticationButtonType.CONTINUE
}
buttonStyle={
AppleAuthentication.AppleAuthenticationButtonStyle.WHITE_OUTLINE
}
cornerRadius={5}
style={styles.button}
onPress={appleLogin}
/>
)}
<GoogleSigninButton
size={GoogleSigninButton.Size.Wide}
color={GoogleSigninButton.Color.Dark}
onPress={signIn}
// disabled={this.state.isSigninInProgress}
/>
<Button title="Sign Out" onPress={signOut} />
</SafeAreaView>
</>
);
}