Flutter Web firebase_auth - How to sign in with different Google account?

Viewed 99

I have a Flutter Web app. When I sign in to an account with GoogleAuthProvider, and sign out again, I want to be able to sign in with a different account than the previous one. However GoogleAuthProvider seems to remember my last signed in account, and automatically signs me in.

How can I accomplish signing in to a different account ?

I have tried to clear localstorage, but there is nothing being saved there by the AuthProvider. window.localStorage.clear();

This is my code for signing in:

Future<UserCredential> _signInWithGoogle() async {
    GoogleAuthProvider googleProvider = GoogleAuthProvider();
    return await FirebaseAuth.instance.signInWithPopup(googleProvider);
}

This is my code for signing out:

    OutlinedButton(
       child: Text('Sign out'),
       onPressed: () async {
           window.localStorage.clear();
           await FirebaseAuth.instance.signOut();
           Navigator.pushNamedAndRemoveUntil(
              context,
              HomePage.route,
              (_) => false,
           );
       },
    )
0 Answers
Related