验证选项卡Firebase中没有保存的用户对象

时间:2018-03-20 10:55:18

标签: ios firebase firebase-authentication

我运行了facebook auth并且运行良好,但是当我进入firebase身份验证选项卡时,用户不在那里

enter image description here

这是代码

import UIKit
import FBSDKCoreKit
import FBSDKLoginKit
import FirebaseFacebookAuthUI

class ViewController: UIViewController {


    @IBOutlet weak var name: UILabel!

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        let loginButton = FBSDKLoginButton()
        loginButton.readPermissions = ["public_profile", "email"]
        // Optional: Place the button in the center of your view.
        loginButton.center = view.center
        view.addSubview(loginButton)
    }

    func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {
        if let error = error {
            print(error.localizedDescription)
            return
        } else {
            let credential = FacebookAuthProvider.credential(withAccessToken: FBSDKAccessToken.current().tokenString)
            print(credential)
            Auth.auth().signIn(with: credential) { (user, error) in
                if let _ = error {
                    return
                }
                self.name.text = "\(user)"
                print("user is sign in")
            }
        }
    }


}

我是否需要进行任何额外配置?

0 个答案:

没有答案