Please provide the following:
- SDK Version: ^35.0.0
- Platforms(Android/iOS/web/all): iOS
- I’m currently using the
expo-google-app-auth
library for the Google OAuth, but I’m having difficulty logging out.
const [accessToken, setAccessToken] = useState('')
const storeToken = async (token) => {
try {
await AsyncStorage.setItem(token, GOOGLE_TOKEN)
} catch (err) {
throw new Error(err)
}
}
const signInWithGoogleAsync = async () => {
try {
const result = await Google.logInAsync({
iosClientId: IOS_CLIENT_ID,
scopes: ['profile', 'email'],
});
if (result.type === 'success') {
storeToken(result.accessToken)
setAccessToken(results.accessToken)
} else {
return { cancelled: true };
}
} catch (e) {
return { error: true };
}
}
const signoutWithGoogleAsync = async () => {
try {
console.log("token in delete", accessToken)
await Google.logOutAsync({ accessToken, iosClientId: IOS_CLIENT_ID })
} catch (err) {
throw new Error(err)
}
}
The config:
const config = {
iosClientId: IOS_CLIENT_ID,
scopes: ['profile', 'email'],
}
And the buttons:
<TouchableHighlight onPress={signInWithGoogleAsync}>
<Text>Login with Google</Text>
</TouchableHighlight>
<TouchableHighlight onPress={signoutWithGoogleAsync}>
<Text>Logout</Text>
</TouchableHighlight>
Even after I logout, which causes no errors, I am able to login without entering the password when I re-login.
-
Once I eject my app, am I still able to use the simulator on my device through the Expo app, not the virtual simulator on the computer? What are the features I would no longer be able to use after ejecting the app?
-
Most of the Google OAuth libraries require ejecting the app, such as expo-google-sign-in, react-native-google-signin, and Firebase SDK. What are the main differences between the OAuth process that requires the native elements and the ones that doesn’t?