swift3でFacebookログイン連携でFirebaseでsignIn後にEmail取得ができません。
Facebookのログインはできていて、FirebaseのAuth.auth().signInも成功しています(エラーもなく、displayNameも取得できるため)。
同じアカウントで他のSwiftプロジェクトでは取得できていますので、Facebookのアカウント設定は問題ありません。GoogleService-Info.plistやInfo.plistは何度も見直していますし、ダウンロードや貼り付けも何度も行ったので、問題無いと思います。
何か考えられる原因をご教授ください。
let fbLoginManager = FBSDKLoginManager() fbLoginManager.logIn(withReadPermissions: ["public_profile", "email"], from: self) { (result, error) in if let error = error { print("DEBUG:Failed to login: (error.localizedDescription)") return } guard let accessToken = FBSDKAccessToken.current() else { print("DEBUG:Failed to get access token") return } let credential = FacebookAuthProvider.credential(withAccessToken: accessToken.tokenString) // Perform login by calling Firebase APIs Auth.auth().signIn(with: credential, completion: { (user, error) in if let error = error { self.showAlert(1) print("DEBUG:Login error: (error.localizedDescription)") } // FireBaseにログインしたので、User登録しPassportでToken取得 if let user = Auth.auth().currentUser { if let value: String = user.email { print ("DEBUG111:(value)") } print ("DEBUG222!") } }) }
上記では、DEBUG111は表示されません。DEBUG222は表示されます。
回答1件
あなたの回答
tips
プレビュー