I am implementing SSO into a mobile app. I have Google SSO set up and working, and just need to finish up with Apple now.
I just need to figure out one last thing and I am good to go. The first time I tried signing in with Apple, I get a response in the structure:
{
authorizationCode: '...',
email: null,
fullName: {
familyName: null,
givenName: null,
middleName: null,
namePrefix: null,
nameSuffix: null,
nickname: null,
},
identityToken: '...',
realUserStatus: 1,
state: null,
user: '...',
}
My issue is now when I try to sign in with Apple, I am not getting the email in the response from Apple. Does anyone know how to fix or overcome this?
My signInWithApple function is as follows:
import * as AppleAuthentication from 'expo-apple-authentication'
const signInWithApple = async () => {
try {
const userInfo = await AppleAuthentication.signInAsync({
requestedScopes: [AppleAuthentication.AppleAuthenticationScope.EMAIL],
})
return userInfo
} catch (error) {
throw error.code
}
}
export default signInWithApple
EDIT
I have seen someone online mention decoding the identityToken, and this did give me the email address, just want to confirm now whether or not this is the right thing to do?