I’m confused related to the GoogleSignIn Logout
first I’ve managed to SignIn
my google account, the problem is when I logout my google account, and SignIn again the previous account that you login before it didn’t ask the password like the image below when I click one of user account it will go to my home screen directly instead asking password for that google account since I’ve already logout the account in my app.
This is my logout function I tried the code below it works in some other way but my concern is since I’ve already logout the account it should not directly go to homepage
when SignIn
again ask password to the user or remove user when logout? What is the best way should I do, do I correcly implement it?
const [user, setUser] = useState(null);
logout: async () => {
try {
await GoogleSignin.revokeAccess();
await GoogleSignin.signOut();
setUser({ user: null });
await auth().signOut();
} catch (e) {
console.log(e);
}
},
GoogleSign function
return (
<AuthContext.Provider
value={{
user,
setUser,
googleLogin: async () => {
try {
// Get the users ID token
const Token = await GoogleSignin.signIn();
const {idToken} = Token;
// Create a Google credential with the token
const googleCredential = auth.GoogleAuthProvider.credential(idToken);
// Sign-in the user with the credential
await auth().signInWithCredential(googleCredential)
.catch(error => {
console.log('Something went wrong with sign up: ', error);
});
} catch(error) {
console.log({error});
}
},
}}>
{children}
</AuthContext.Provider>
);