CodetrixStudio / CapacitorGoogleAuth

Capacitor plugin for Google Auth. Lightweight & no dependencies.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to always choose a Google account from a list

JohnBuchmann opened this issue · comments

If you log in with one Google account, you are literally not able to switch to another Google account. When logging in, this plugin will use the account you last authenticated with, and you have no way to override this.

Interestingly, on the web with Firefox (only), it will always prompt you to choose a Google account. But on other browsers, and on Android (I also assume iOS) you cannot. This is a real problem since the user will be forced to forever use only one Google account login. Even if you uninstall and reinstall the mobile app it will auto login with the last account used.

There is a similar post from a couple years ago, but the solution said to signOut() before signing in. But that doesn't solve this issue. Thx!

any solution you found?

No solution yet. But I ended up reverting from Android/iOS to just PWA. This is because on Android things get just way too sluggish. It appears to be a Capacitor with webView issue: ionic-team/capacitor#3899
So now as a web app/PWA I am back to using standard google login (I'm using Angular Firebase UI library to make it even easier) and I have no need for CapacitorGoogleAuth

any other npm dependancy i am usisng vue js capacitor

I have added the GoogleAuth.signOut() before the signIn and it worked. on Android now alway ask for an account if I press the google login button.

using vite, capacitor 4, vue 3

@aljacket it depends on the device and network speed as the current Android code is not correct.
I opened a pull request with the fix #288

any solution you found?

@tarangshah19

I think this is the best solution out there for now.

Just log out before logging back in. For example:

async function signInWithGoogle() {
    await GoogleAuth. signOut();
    const user = await GoogleAuth.signIn();
    authStore. handleLoginGoogle(user); //Optional for store
}

I tried it on iOS and it works perfectly :)

I'm using Vue 3 and Ionic 7