android - Google Sign-in iOS account picker -


i'm using google sign-in in ios app. followed google tutorial (https://developers.google.com/identity/sign-in/ios/sign-in#add_the_sign-in_button) uses gidsigninbutton user has click. when clicks redirected safari looks this:

enter image description here

the problem have multiple google accounts , able pick 1 want use. takes 1 of them automatically , have press "deny" or "allow". also, don't fact app gets redirected chrome. ideally want google hangouts app on ios:

enter image description here

it shows accounts have used sign in google app , lets decide ones use app without leaving app. on android got similar working app:

enter image description here

how can achieve kind of behaviour (don't leave app + account chooser) in ios app?

the reason able in google hangouts because it's made google. companies don't make every feature available developers , prime example of it. reason able in android because google decided allow developers more access different features. after all, android developed google. not leaving app use embedded web view. keep user in app , instead pop web view modally. it's not best in world, better having user sent somewhere else. have tried code:

// implement these methods if gidsigninuidelegate not subclass of // uiviewcontroller.  // stop uiactivityindicatorview animation started when user // pressed sign in button func signinwilldispatch(signin: gidsignin!, error: nserror!) {   myactivityindicator.stopanimating() }  // present view prompts user sign in google func signin(signin: gidsignin!,     presentviewcontroller viewcontroller: uiviewcontroller!) {   self.presentviewcontroller(viewcontroller, animated: true, completion: nil) }  // dismiss "sign in google" view func signin(signin: gidsignin!,     dismissviewcontroller viewcontroller: uiviewcontroller!) {   self.dismissviewcontrolleranimated(true, completion: nil) } 

i found on link posted. haven't run or tested code appears present view controller instead of sending safari. may more along lines of want.

to answer @sam's question:

"how login google existing installed google apps rather opening url in safari?"

you accomplish android not ios. example of restricted because of platform selected.

remember whatever option end choosing still required adhere oauth 2.0. suggest if @ possible using google has built out ios developers use. when comes selecting different account default one, if chose follow guide , google created ios developers, can tap on profile image , switch accounts.

tl;dr

https://www.youtube.com/watch?time_continue=227&v=-26dgo_e1ds


Comments