I have a problem with the implementation of Google Auth within a React Native app managed with Expo. When I try to login, the response does not contain an IdToken or the information of the user and I don't understand why...
Here is my code :
import * as Google from 'expo-auth-session/providers/google';
const [request1, response1, promptAsync1] = Google.useAuthRequest({
expoClientId: 'my-expo-id',
iosClientId: 'my-ios-id',
});
React.useEffect(() => {
if (response1?.type === 'success') {
const { authentication } = response1;
}
}, [response]);
console.log('reponse', response1)
return (
<View>
<TouchableOpacity onPress={() => promptAsync1()}>
<Text style={styles.connexionText}>Connect with Google</Text>
</TouchableOpacity>
</View>
)
And here is the response :
reponse Object {
"authentication": TokenResponse {
"accessToken": "ya29.a0AfH6SMAEdPx5RcQP57rtdr4gV8GxFD1VSLAjovOce5X1yP-a2S6inLcSHF3KlxqmbKt0Cl6Catuyuua9Jz0rtV5psUUqWWX_QT32rXJwt9LTQywQaOzyy4cwspbOLm6W063w27f7NRiizC9RBg69-Yh09OhN",
"expiresIn": "3599",
** "idToken": undefined, **
"issuedAt": 1617701320,
** "refreshToken": undefined, **
"scope": "email profile https://www.googleapis.com/auth/userinfo.profile openid https://www.googleapis.com/auth/userinfo.email",
"state": "RwgjNwizdQ",
"tokenType": "Bearer",
},
"error": null,
"errorCode": null,
"params": Object {
"access_token": "ya29.a0AfH6SMAEdPx5RcQP57rtdr4gV8GxFD1VSLAjovOce5X1yP-a2S6inLcSHF3KlxqmbKt0Cl6Catuyuua9Jz0rtV5psUUqWWX_QT32rXJwt9LTQywQaOzyy4cwspbOLm6W063w27f7NRiizC9RBg69-Yh09OhN",
"authuser": "0",
"exp://172.20.10.3:19000/--/expo-auth-session": "",
"expires_in": "3599",
"prompt": "none",
"scope": "email profile https://www.googleapis.com/auth/userinfo.profile openid https://www.googleapis.com/auth/userinfo.email",
"state": "RwgjNwizdQ",
"token_type": "Bearer",
},
"type": "success",
"url": "exp://172.20.10.3:19000/--/expo-auth-session#state=RwgjNwizdQ&access_token=ya29.a0AfH6SMAEdPx5RcQP57rtdr4gV8GxFD1VSLAjovOce5X1yP-a2S6inLcSHF3KlxqmbKt0Cl6Catuyuua9Jz0rtV5psUUqWWX
_QT32rXJwt9LTQywQaOzyy4cwspbOLm6W063w27f7NRiizC9RBg69-Yh09OhN&token_type=Bearer&expires_in=3599&scope=email%20profile%20https://www.googleapis.com/auth/userinfo.profile%20openid%20https:/
/www.googleapis.com/auth/userinfo.email&authuser=0&prompt=none",
}
Thanks a lot in advance for your help !