问题
I'm trying to move to my new view controller after the auth is complete and the user has loged into facebook but I get a error saying "Error Domain=FIRAuthErrorDomain Code=17999 "An internal error has occurred, print and inspect the error details for more information."" I've looked over the documentation and it looks right to me but maybe I'm missing something. Here is my code for my facebook login button
@IBAction func FacebookBtnPressed(sender: AnyObject) {
let login = FBSDKLoginManager()
login.logInWithReadPermissions(["email"], fromViewController: self) { (result: FBSDKLoginManagerLoginResult!, facebookError: NSError!) -> Void in
if (facebookError != nil) {
print("Facebook login failed. Error: \(facebookError)")
} else if result.isCancelled {
print("Cancelled")
} else {
let acessToken = FBSDKAccessToken.currentAccessToken().tokenString
print("Logged in. \(acessToken)")
let credential = FIRFacebookAuthProvider.credentialWithAccessToken(FBSDKAccessToken.currentAccessToken().tokenString)
FIRAuth.auth()?.signInWithCredential(credential, completion: { (user, error) in
if error != nil {
print("Login failed. \(error)")
} else {
print("Logged in. \(user)")
let userData = ["provider": credential.provider]
DataService.ds.createFirebaseUser(user!.uid, user: userData)
NSUserDefaults.standardUserDefaults().setValue(user!.uid, forKey: KEY_UID)
self.performSegueWithIdentifier("loggedIn", sender: nil) // currently not working
}
})
Full Error log:
(Error Domain=FIRAuthErrorDomain Code=17999 "An internal error has
occurred, print and inspect the error details for more information."
UserInfo={NSUnderlyingError=0x7fa702c55080 {Error Domain=FIRAuthInternalErrorDomain Code=3 "(null)" UserInfo={FIRAuthErrorUserInfoDeserializedResponseKey={type = immutable dict, count = 3, entries => 0 : {contents = "message"} = {contents = "Project marked for deletion."} 1 : errors = {type = immutable, count = 1, values = ( 0 : {type = immutable dict, count = 4, entries => 1 : message = {contents = "Project marked for deletion."} 3 : reason = {contents = "accessNotConfigured"} 4 : domain = {contents = "usageLimits"} 5 : {contents = "extendedHelp"} = {contents = "https://console.developers.google.com"} })} 2 : code = {value = +403, type = kCFNumberSInt64Type} } }}, error_name=ERROR_INTERNAL_ERROR, NSLocalizedDescription=An internal error has occurred, print and inspect the error details for more information.})
回答1:
Fixed.. I created a new project and I forgot to import the new plist file and the API key. It was using the old one so that's why it said in the log "marked for deletion"
来源:https://stackoverflow.com/questions/37710339/firebase-unable-to-login-to-facebook-auth