question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NotAuthorizedException: Token is not from a supported provider of this identity pool.

See original GitHub issue

Describe the bug

Unable to login with Facebook (react-native).

To Reproduce

  1. Run through the default social provider auth flow with amplify add auth
  2. Create a facebook app, add appId + appSecret to amplify config
  3. Add app domain provided by cognito to FB dev page
  4. Set the website with appended path (eg: https://zatiq-mobile-app-dev.auth.us-east-1.amazoncognito.com/oauth2/idpresponse)
  5. Use the example code for setting up react native facebook login (PS Expo no longer exposes a facebook property, it now comes from ‘expo-facebook’ package).
  6. Attempt to sign with Auth.federatedSignIn

results in: NotAuthorizedException: Token is not from a supported provider of this identity pool.

Expected behavior Should receive credentials

Screenshots && Full Code Samples Here they are, I hope they help:

Generated aws-exports.js file (imported at the root of the app):

const awsmobile = { "aws_project_region": "us-east-1", "aws_cognito_identity_pool_id": "us-east-1:b34dbc6d-dd57-4bd8-9e00-10d8e47039ea", "aws_cognito_region": "us-east-1", "aws_user_pools_id": "us-east-1_SYQGQiN5S", "aws_user_pools_web_client_id": "t851knsevlqsm11spa7huoerj", "oauth": { "domain": "zatiq-mobile-app-dev.auth.us-east-1.amazoncognito.com", "scope": [ "phone", "email", "openid", "profile", "aws.cognito.signin.user.admin" ], "redirectSignIn": "exp://192.168.2.15:19000/", "redirectSignOut": "exp://192.168.2.15:19000/", "responseType": "code" }, "federationTarget": "COGNITO_USER_POOLS", "aws_content_delivery_bucket": "zatiq-mobile-app-hosting-dev", "aws_content_delivery_bucket_region": "us-east-1", "aws_content_delivery_url": "http://zatiq-mobile-app-hosting-dev.s3-website-us-east-1.amazonaws.com" };

Cognito config verifying Facebook data is there (I have omitted the app secret for this screenshot)

Screen Shot 2019-08-12 at 7 52 58 PM

Verifying that I haven’t used the wrong cognito pool:

Screen Shot 2019-08-12 at 7 54 46 PM

Screenshot of setting the website url on facebook with appended paths:

Screen Shot 2019-08-12 at 7 54 02 PM

full login code:

`const signIn = async () => { const { type, token, expires } = await Facebook.logInWithReadPermissionsAsync( ‘705885429837326’, { permissions: [‘public_profile’], behavior: ‘native’, } );

if (type === 'success') {
  const response = await fetch(`https://graph.facebook.com/me?access_token=${token}`);
  const { name } = await response.json();

  Auth.federatedSignIn(
    'facebook',
    { token, expires_at: expires },
    { name, }
  )
    .then(credentials => {
      console.log('get aws credentials', credentials);
    }).catch(e => {
      console.log(e);
    });
}

}`

Desktop (please complete the following information):

  • OS: macOS Mojave
  • Browser Chrome

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

I’ve checked other issues in this repo (there are a few that have this same error) but alas was unable to pinpoint what I’m doing wrong 😦

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
silinskicommented, Jan 27, 2020

The issue was actual for me as well. Identity poll was created but I have to put manually Facebook App Id and Google App Id to Authentication providers list

1reaction
silinskicommented, Apr 23, 2020

@Jun711 it didn’t work without Federated Identities pool Authentication providers for me in January. Without Federated Identities pool Authentication providers Amplify CLI didn’t push tokens to the AWS Cognito however, they were configured locally in the CLI.

There is a chance that it was fixed with new releases, but I didn’t check

Read more comments on GitHub >

github_iconTop Results From Across the Web

Amazon Web Services (AWS) Cognito error "Token is not from ...
NotAuthorizedException : Token is not from a supported provider of this identity pool. (Service: AmazonCognitoIdentity; Status Code: 400; Error ...
Read more >
Token is not from a supported provider of this identity pool ...
I'm trying to use Google Auth with AWS Cognito in a React Native configuration but when I use federatedSignIn, I'm getting an error...
Read more >
Cognito Login With Amazon "Token is not from a supported ...
This issue usually occurs if the app client used for authenticating the user is different from the app client configured with the identity...
Read more >
Token is not from a supported provider of this identity pool
If you are getting the following error, probably you have the wrong User Pool ID or App Client Id in your identity pool....
Read more >
Accessing AWS services using an identity pool after sign-in
Integrating a user pool with an identity pool. After your app user is authenticated, add that user's identity token to the logins map...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found