0
我在我的iOS應用程序中使用Facebook登錄與Firebase,但我無法將用戶的數據保存到數據庫,因爲authWithOAuthProvider似乎是從我可以返回一個differend uid字符串請在儀表板中查看。這是一個已知的問題?這裏是我的代碼:iOS的Firebase - Facebook的authWithOAuthProvider返回不正確的用戶ID
@IBAction func tappedFacebookLogin(sender: AnyObject) {
User.sharedModel.facebookUser = true
let loginManager = FBSDKLoginManager()
let permissions = ["public_profile", "email"]
loginManager.logInWithReadPermissions(permissions, fromViewController: self, handler: { fbResult, fbError in
if fbError != nil {
// error in login
print("fbError: \(fbError.code)")
}
else if fbResult.isCancelled {
// cancelled login
print("cancelled facebook login")
}
else {
// fb logged in
self.startProgressHud()
let accessToken = FBSDKAccessToken.currentAccessToken().tokenString
FirebaseManager.sharedRootRef.authWithOAuthProvider("facebook", token: accessToken, withCompletionBlock: { error, authData in
if error != nil {
self.handleFirebaseError(error)
}
else {
// firebase logged in
print(authData.uid)
self.getUserDataAndLogin(authData.uid)
}
})
}
})
}
請更新一些相關的截圖,以顯示確切的情況。 – Shubhank