How to get Google Accounts Chooser in Ionic 3 iOS

452 Views Asked by At

I used Ionic Google Plus plugin to develop this.

https://ionicframework.com/docs/native/google-plus

However I could not find a way to get the Google Accounts Chooser like in Android.

Google Login

In other native apps that feature is there.

enter image description here

Google Accounts Chooser

But when used with Cordova Google Plus Plugin it just loads a SafariViewController with the Google Login screen. I tried trySilentLogin() function as well. But it just saves the login state after the first login. I want the user to select a logged in Google Account using the Google Account Chooser without entering passwords.

If it's not possible using Cordova Google Plus plugin what are the other alternatives to implement this?

2

There are 2 best solutions below

0
Guy L. On

I found out the problem of why account is not shown in google accounts chooser (at least after upgrading the ios sdk to SFAuthenticationSession, I don't know if it happened from same reason before upgrade): The google sso authentication accounts are saved in safari data and if you clear safari cache then the accounts are removed. This can be easily reproduced by logging in, in one app (such as yelp, tripadvisor and others) and then you WILL see accounts in other apps on google login. Then clean safari cache and offline data and then you will not see the accounts in other apps on google login. Facebook solved it using custom scheme redirect in a "open in app" button displayed in the SFAuthenticationSession.

0
KrishnaCA On

When the user logs out, if we call GIDSignIn.sharedInstance()?.signOut(). Next time, then the email selection screen will appear.

It works for us