New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firebase Auth: We need to upgrade package with new changes made in Facebook Login for iOS #12713
Comments
same issue in my unity game. Error Message: Firebase.FirebaseException: Bad access token: {"code":190,"message":"Invalid OAuth access token - Cannot parse access token"} |
@owllyi Have you find any solution? |
Hello @RaghvindYadav, Thank you for reporting this issue. Based on the link you shared, it appears that the problem may not be related to FlutterFire but rather to the Facebook SDK plugin you are using. Did I understand that correctly? If so, you might consider opening an issue in their respective repository to get further assistance. |
Hi @TarekkMA |
I will attempt to reproduce this issue. In the meantime, you might find it helpful to look at a similar issue reported with the Facebook SDK here: facebook-ios-sdk issue #2365. This may provide some insights into the problem you are encountering. Additionally, I suspect that FlutterFire may not be responsible for this error, but I will confirm this as I investigate further. |
Hi @RaghvindYadav, The issue is due to the Facebook SDK/plugin. As mentioned here we need to get the nonce. We'll need a plugin that supports limited login to utilize this updated code snippet: final provider = OAuthCredential(
providerId: 'facebook.com',
signInMethod: 'oauth',
idToken: accessToken.token,
rawNonce: rawNonce,
); |
@TarekkMA I did the above you mentioned, still getting the same error. |
#if UNITY_ANDROID |
Thank you @TarekkMA, I used that package but still persisting with same problem. Now accessToken looks quite different than previous response. |
I've looked into the new package, can you try using this instead and let me know if it works: final AccessToken accessToken = result.accessToken!;
final AuthCredential credential;
switch (accessToken.type) {
case AccessTokenType.classic:
final token = accessToken as ClassicToken;
credential = FacebookAuthProvider.credential(token.authenticationToken!,);
break;
case AccessTokenType.limited:
final token = accessToken as LimitedToken;
credential = OAuthCredential(
providerId: 'facebook.com',
signInMethod: 'oauth',
idToken: token.tokenString,
rawNonce: token.nonce,
);
break;
}
// Login with token
await auth.signInWithCredential(credential); We might need to add a new option in the future for limited login so it can be just |
@TarekkMA AccessTokenType.limited getting this error for now If I changed this parameter |
I can reproduce this error, I guess the signInMethod should be oauth for it to work, since /cc @Lyokone |
@owllyi does your implementation work? var authToken = FaceBookManager.Instance.GetToken(); Would be interesting how your facebook-login implementation looks like. I got this error: Do you use the hashed nonce or raw nonce in |
Found a solution. This is what I found in firebase documentation: "You will send the SHA-256 hash of the nonce with your sign-in request, which Facebook will pass unchanged in the response. Firebase validates the response by hashing the original nonce and comparing it to the value passed by Facebook." Facebook-Login: Firebase Credentials: |
Is there an existing issue for this?
Which plugins are affected?
Auth
Which platforms are affected?
iOS
Description
I am integrating my app with Facebook login but facing a problem in iOS version which is greater than 17.0. The login get failed.
Getting error : Firebase Auth error: [firebase_auth/invalid-credential] {"code":190,"message":"Invalid OAuth access token - Cannot parse access token"}
Reproducing the issue
The above is worked well for android and iOS device which ios version is less than 17, but we need to upgrade Facebook sign for iOS 17.o and greater.
Here is a url of blog. https://developers.facebook.com/blog/post/2024/03/28/changes-made-to-fb-login-sdk/
Firebase Core version
2.30.1
Flutter Version
3.19.5
Relevant Log Output
Flutter dependencies
Additional context and comments
https://developers.facebook.com/blog/post/2024/03/28/changes-made-to-fb-login-sdk/
The text was updated successfully, but these errors were encountered: