Skip to content
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

Facebook federated signin not working? #13

Open
yuensunn opened this issue Nov 11, 2019 · 4 comments
Open

Facebook federated signin not working? #13

yuensunn opened this issue Nov 11, 2019 · 4 comments

Comments

@yuensunn
Copy link

Currently using the latest flutter_cognito_plugin from git and flutter_facebook_login: 3.0.0 for the facebook login function. Here is my code.

 facebookLogin.logIn(['public_profile', 'email']).then((result) {
            print(result.accessToken.token);

// passing user access token into the token field
            Cognito.federatedSignIn("Facebook", result.accessToken.token)
                .then((res) {
              print(res);
              c.complete(res);
            });
          }).catchError((error) {
            c.completeError(error);
          });

Error that I am getting

[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(com.amazonaws.services.cognitoidentity.model.NotAuthorizedException, Invalid login token. Not a valid OpenId Connect identity token. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: NotAuthorizedException; Request ID: a6f64c73-244b-452c-a869-0d207582b254), com.amazonaws.services.cognitoidentity.model.NotAuthorizedException: Invalid login token. Not a valid OpenId Connect identity token. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: NotAuthorizedException; Request ID: a6f64c73-244b-452c-a869-0d207582b254)
@samuelchanx
Copy link

samuelchanx commented Dec 3, 2019

It should be graph.facebook.com, not Facebook. As shown on the AWSMobileClient below:

AMAZON("www.amazon.com"),
FACEBOOK("graph.facebook.com"),
GOOGLE("accounts.google.com"),
TWITTER("api.twitter.com"),
DEVELOPER("cognito-identity.amazonaws.com"),

https://github.com/aws-amplify/aws-sdk-android/blob/e1f9c8121afb567c075782328a9d38b3863a0db6/aws-android-sdk-mobile-client/src/main/java/com/amazonaws/mobile/client/IdentityProvider.java#L25

This works like a charm for me :)

@yuensunn
Copy link
Author

yuensunn commented Dec 4, 2019

Thanks a lot @samuelchanx ! Will give it a try

@robert-stevens
Copy link

@yuensunn were you able to get this working?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants