My app was authenticating users fine before, and then I implemented the new auth code for twitter:
vc.twitterLogin = { session, error in
if let session = session {
let credential = FIRTwitterAuthProvider.credentialWithToken(session.authToken, secret: session.authTokenSecret)
FIRAuth.auth()?.signInWithCredential(credential) { [unowned self] user, error in
if let error = error {
print(error.userInfo["NSUnderlyingError"])
}
if user != nil {
self.navCtrl.popViewControllerAnimated(true)
self.delegate?.didAuthenticate(self)
}
}
}
}
The twitter authentication works fine as you can see it's executing the FIRAuth block. Any ideas?
Here is the error:
Optional(Error Domain=FIRAuthInternalErrorDomain Code=3 "(null)" UserInfo={FIRAuthErrorUserInfoDeserializedResponseKey={type = immutable dict, count = 3, entries => 0 : {contents = "message"} = {contents = "Fail to get successful verify_credentials response from Twitter: {"errors":[{"code":32,"message":"Could not authenticate you."}]}"} 1 : errors = {type = immutable, count = 1, values = ( 0 : {type = immutable dict, count = 3, entries => 0 : reason = invalid 1 : message = {contents = "Fail to get successful verify_credentials response from Twitter: {"errors":[{"code":32,"message":"Could not authenticate you."}]}"} 2 : domain = global }
)} 2 : code = {value = +400, type = kCFNumberSInt64Type} } })
To get all the users from auth in Firebase, you can use the Admin SDK for Firebase. It gives you elevated privileges to perform operations in the system that a normal user can not. The Admin SDK comes with a lot of functionality built-in.
Don't forget to go in Firebase Project Settings > App check > and Register firebase project in SafetyNet and Play Integrity register with default time token 1 hour and u will remove reCaptcha from phone auth OTP!
You need to update your Firebase Twitter API keys in the new interface (Auth -> Sign In Method -> Twitter) to the auto-generated ones that Fabric.io has provided you with. These are available in the Fabric.IO interface.
My guess is that you've let Fabric.IO automatically generate new keys for you against the Twitter API and are using those in the new custom Fabric.IO entry in your Info.plist but have not yet changed them on Firebase. Updating these entries fixed the issue for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With