Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

414
Views
GoogleSignIn Authentication in React Native

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.

enter image description here

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>
  );
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Short Answer: Your code is completely fine!

Long Answer: This is completely normal behaviour and is intended to be. If you want to Sign Out completely you would have to go into the settings of the corresponding google account and sign out from that device. (Manage Google Account => Security => My Devices => Logout)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!