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

后端 未结 3 1190
误落风尘
误落风尘 2021-01-20 19:51

I\'m following https://firebase.google.com/docs/auth/ and want to use FirebaseUI (https://github.com/firebase/FirebaseUI-iOS/tree/master/FirebaseUI) for authentication.

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-20 20:41

    Essentially you need to add the below to the root of the plist.

    CFBundleURLTypes
    
        
            CFBundleURLSchemes
            
                com.googleusercontent.apps.your-app-id
            
        
    
    

    You can get your app id from the RESERVED_CLIENT_ID entry in your GoogleService-Info.plist file.

    Next, you will need to implement the openURL app delegate method like this:

    func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
    
        return GIDSignIn.sharedInstance().handle(url, sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String, annotation: options[UIApplicationOpenURLOptionsKey.annotation])
    }
    

    Check out my answer here for some more details.

提交回复
热议问题