Comments (13)
same issue in my unity game.
Unity: 2021.3.37f1
Firebase SDK: 10.2.0
Facebook SDK: 17.0.0
Error Message:
SignInWithCredentialAsync encountered an error: System.AggregateException: One or more errors occurred. (One or more errors occurred. (Bad access token: {"code":190,"message":"Malformed access token"}))
Firebase.FirebaseException: Bad access token: {"code":190,"message":"Invalid OAuth access token - Cannot parse access token"}
from flutterfire.
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.
from flutterfire.
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,
);
from flutterfire.
@owllyi Have you find any solution?
#if UNITY_ANDROID
credential = Firebase.Auth.FacebookAuthProvider.GetCredential(accessToken);
#elif UNITY_IOS
var authToken = FaceBookManager.Instance.GetToken();
var nonce = FaceBookManager.Instance.GetNonce();
credential = Firebase.Auth.OAuthProvider.GetCredential("facebook.com", authToken, nonce, null);
#endif
from flutterfire.
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 FacebookAuthProvider.limitedCredential(....)
from flutterfire.
I can reproduce this error, I guess the signInMethod should be oauth for it to work, since signInMethod: 'facebook.com'
will not use nonce, or the idToken.
/cc @Lyokone
from flutterfire.
@owllyi Have you find any solution?
from flutterfire.
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.
from flutterfire.
Hi @TarekkMA
May be you are right but I am getting failed error at this line of code return FirebaseAuth.instance.signInWithCredential(facebookAuthCredential);
And FirbaseAuth comes form firebase_auth package.
from flutterfire.
@TarekkMA I did the above you mentioned, still getting the same error.
Also use a new package https://pub.dev/packages/flutter_facebook_auth/versions/7.0.0-dev.3/changelog#700-dev3
from flutterfire.
@TarekkMA I did the above you mentioned, still getting the same error. Also use a new package https://pub.dev/packages/flutter_facebook_auth/versions/7.0.0-dev.3/changelog#700-dev3
Thank you @TarekkMA, I used that package but still persisting with same problem. Now accessToken looks quite different than previous response.
from flutterfire.
@TarekkMA AccessTokenType.limited getting this error for now Firebase Auth error: [firebase_auth/missing-or-invalid-nonce] The nonce in ID Token "C7D21692-B861-4E45-A912-DB9F4502AA2B" does not match the SHA256 hash of the raw nonce "C7D21692-B861-4E45-A912-DB9F4502AA2B" in the request.
If I changed this parameter signInMethod: 'oauth'
to signInMethod: 'facebook.com'
, then app get crashed.
from flutterfire.
@owllyi does your implementation work?
var authToken = FaceBookManager.Instance.GetToken();
var nonce = FaceBookManager.Instance.GetNonce();
credential = Firebase.Auth.OAuthProvider.GetCredential("facebook.com", authToken, nonce, null);
Would be interesting how your facebook-login implementation looks like. I got this error:
The nonce in ID Token "xxx" does not match the SHA256 hash of the raw nonce "xxx" in the request
Do you use the hashed nonce or raw nonce in
FB.Mobile.LoginWithTrackingPreference
method?
from flutterfire.
Related Issues (20)
- BUG: unhandled exception No address associated with hostname HOT 1
- Firestore: Streaming Snapshot Errors in Flutter Web Application After FlutterFire CLI and Plugin Updates HOT 4
- storage: file storage with dynamic directory not visible in gcsfuse HOT 3
- [📚] Your documentation feedback title (CHANGE ME)
- cloud_firestore: iOS includeMetadataChanges does not recieve isFromCache false after first run HOT 14
- [firebase_auth]: [firebase_auth/unknown-error] An internal error has occurred. (when calling signinwithemailandpassword on windows) HOT 10
- [FileSystemEntity]: <Is it a bug? I can't read json file via File.readAsStringSync or File.readAsString> HOT 1
- [firebase_auth]: <Requests from this Android client application <empty> are blocked.> HOT 2
- FirebaseAuth.instance.currentUser always null on windows app flutter !! HOT 3
- Firebase Auth: reCaptcha shows up even after configuring Silent APN correctly HOT 2
- Google SignIn Crashing on iOS
- [firebase_core]: not working with cocoapods 1.15.2 HOT 8
- [BUG]: Error: Unable to get Xcode project information ... Unable to read project 'Runner.xcodeproj'. After Running Flutterfire Configure on MACOS HOT 1
- [firebase_messaging]: iOS Background receive Message HOT 2
- [firebase_core]: 'pod update' cannot be done when 'firebase core' is updated to the latest version HOT 5
- Lost connection to device in desktop flutter app Firebase Storage ! HOT 3
- [remote_config]: setConfigSettings on windows raises an exception HOT 1
- Problem with GoogleUtilities after Declaring :linkage => :static in Podfile HOT 3
- [📚] Your documentation feedback title (CHANGE ME)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutterfire.