How to use FirebaseUI for Google authentication on iOS in Swift? -


i'm following https://firebase.google.com/docs/auth/ , want use firebaseui (https://github.com/firebase/firebaseui-ios/tree/master/firebaseui) authentication.

the ui shows , i'm able click "sign in google" , complete web sign in flow. app re-opens auth url, authui function never fires. what's wrong?

    func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool {     // override point customization after application launch.     firapp.configure()      let authui = firauthui.authui()!;     nslog("setting delegate");     authui.delegate = self;      let googleauthui = firgoogleauthui.init(clientid:firapp.defaultapp()!.options.clientid);      authui.signinproviders = [googleauthui!];       msplitviewcontroller = self.window!.rootviewcontroller as! uisplitviewcontroller       self.window!.rootviewcontroller = authui.authviewcontroller();      return true }      func authui(authui: firauthui, didsigninwithuser user: firuser?, error:nserror?) {     // implement method handle signed in user or error if any.     nslog("logged in");      self.window!.rootviewcontroller = msplitviewcontroller     let navigationcontroller = msplitviewcontroller!.viewcontrollers[msplitviewcontroller!.viewcontrollers.count-1] as! uinavigationcontroller      navigationcontroller.topviewcontroller!.navigationitem.leftbarbuttonitem = msplitviewcontroller!.displaymodebuttonitem()     msplitviewcontroller!.delegate = self      let masternavigationcontroller = msplitviewcontroller!         .viewcontrollers[0] as! uinavigationcontroller     let controller = masternavigationcontroller.topviewcontroller as! masterviewcontroller     controller.managedobjectcontext = self.managedobjectcontext }   func application(application: uiapplication,     openurl url: nsurl, options: [string: anyobject]) -> bool {         nslog("opened url \(url)");         firauthui.authui()!.delegate = self;         return firauthui.authui()!.handleopenurl(url, sourceapplication:options[uiapplicationopenurloptionssourceapplicationkey] as! string); } 

i haven't tried solution stackoverflow problem linked firebaseui repo's issues section , there responded;

obj-c: "there's bug prevents [[firauthui authui] authviewcontroller] being used root view controller of app. workaround use placeholder view controller app's root view controller, present [[firauthui authui] authviewcontroller] on top of it."

for swift users: there's bug prevents firauthui.authui().authviewcontroller() being used root view controller of app. workaround use placeholder view controller app's root view controller, present firauthui.authui().authviewcontroller() on top of it.

link: https://github.com/firebase/firebaseui-ios/issues/65


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -