Package version used:
flutter_facebook_auth: ^7.0.0
firebase_core: ^2.24.2
firebase_auth: ^4.15.2
FBSDKLoginKit (17.0.2) //pod
I have tested recently with our app and can’t login with Facebook and upon debugging, I’ve seen this error
Unhandled Exception: [firebase_auth/invalid-credential] {"code":190,"message":"Bad signature"}
Login attempt code:
Future<dynamic> signInWithFacebook() async {
// try {
final LoginResult loginResult = await _facebookAuth.login();
if (loginResult.accessToken == null) {
_hasError = true;
_loginErrorMsg = 'Login cancelled.';
notifyListeners();
return null;
}
// Create a credential from the access token
final OAuthCredential facebookAuthCredential =
FacebookAuthProvider.credential(loginResult.accessToken!.tokenString);
UserCredential userCredential = await FirebaseAuth.instance
.signInWithCredential(facebookAuthCredential);
}
The result of loginResult is LoginStatus.success
.
Is someone experiencing the same issue? What are the steps have you done to resolve?
2
Answers
The credentials used to authenticate the Admin SDKs cannot be used to perform the desired action. Certain Authentication methods such as createCustomToken() and verifyIdToken() require the SDK to be initialized with a certificate credential as opposed to a refresh token or Application Default credential. See Initialize the SDK for documentation on how to authenticate the Admin SDKs with a certificate credential.
For iOS
I have the same issue, below code that issue
Generates a cryptographically secure random nonce, to be included in a
credential request.