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

Default social provider buttons don’t work with basic setup #4269

Closed
YahngSungho opened this issue Oct 27, 2019 · 5 comments
Closed

Default social provider buttons don’t work with basic setup #4269

YahngSungho opened this issue Oct 27, 2019 · 5 comments
Labels
bug Something isn't working pending-close-response-required A response is required for this issue to remain open, it will be closed within the next 7 days. React React related issues

Comments

@YahngSungho
Copy link

YahngSungho commented Oct 27, 2019

Describe the bug

socialProvider1

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

But ‘Sign in with AWS’ seems to work.

2019-10-27 18 52 11 Signin - Chrome

One thing to consider is that I mistyped the information to the federated prop. That's the only difference I can think of. But I'm sure they're right.

I don't know if it's relevant, but one more weird thing is that Authenticator Comp doesn't work either. To be clear, it only show ‘Loading...’ And if I hide loading, It doesn't show anything. So I use only withAuthenticator HOC.
(But Authenticator Comp doesn't work too when I don't provide federated prop, so it might be another problem)

So basically my code is this:

Amplify.configure(awsconfig)
const federated = {
  google_client_id: '<google-id>',
  facebook_app_id: '<fb-id>',
  amazon_client_id: ''
}

export default withAuthenticator(App, true, [], federated)

I think there is nothing special in my code. I just did a basic setup. Maybe something wrong with the amplify installation or configuration, but I don't know where to look.

Also I don't know if it's relevant, it's my aws-export.js

// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.

const awsmobile = {
    "aws_project_region": "us-east-1",
    "aws_cognito_identity_pool_id": "<idp-id>",
    "aws_cognito_region": "us-east-1",
    "aws_user_pools_id": "<up-id>",
    "aws_user_pools_web_client_id": "<upwc-id>",
    "oauth": {
        "domain": "<oa-domain>",
        "scope": [
            "phone",
            "email",
            "openid",
            "profile",
            "aws.cognito.signin.user.admin"
        ],
        "redirectSignIn": "http://localhost:5000/",
        "redirectSignOut": "http://localhost:5000/",
        "responseType": "code"
    },
    "federationTarget": "COGNITO_USER_POOLS"
};


export default awsmobile;

Desktop (please complete the following information):

  • OS: Window 7
  • Browser: chrome
  • Version: latest

Amplify context

  • Framework: React
  • Versions of Amplify you are using: latest
@YahngSungho YahngSungho added the bug Something isn't working label Oct 27, 2019
@sammartinez sammartinez added the React React related issues label Mar 10, 2020
@haruharuharuby
Copy link

Hi, @sammartinez (CC: @YahngSungho )

I got the same issue with a super simple code. I did not change code mostly in this sample.
https://docs.amplify.aws/lib/auth/social/q/platform/js#full-react-sample

And I only use the Cognito Hosted UI as Social Provider.

I did debug the problem. Do you have some wonder about package dependencies?
In my case, I did debug as follows.

  1. The NotAuthorizedException was raised from the GetIdCommand this command exists in amplify-core.
    https://github.com/aws-amplify/amplify-js/blob/master/packages/core/src/Credentials.ts#L239
    This is a method from aws-sdk-v3. AWS SDK v3 is currently beta yet.

  2. With debugging on Chrome,
    The token endpoint of Cognito was successfully called.
    I confirmed the accessToken internally.
    But later it's in the above operation, Calling Cognito-identity endpoint was failed.
    This is from the GetIdCommand.

chrome-debug-token-ep-success

chrome-debug-cognito-idp-fail

I can implement OAuth flow manually, But of course, it's better to simpler implementation.
If I can check something, Please let me know.

I'm happy if this issue will be handled as fast as possible.

@ericclemmons
Copy link
Contributor

@YahngSungho @haruharuharuby Can you adjust your code to use Auth.federatedSignIn, according to:

https://docs.amplify.aws/lib/auth/social/q/platform/js#setup-frontend

That should work out-of-the-box with the least amount of custom code to validate that federated sign-in works & is configured correctly. (I want to confirm that @YahngSungho & @haruharuharuby are experiencing the same thing)

You're doing the correct thing by signing in with Hosted UI first to validate your config (this URL can be found via amplify status!), then Auth.federatedSignIn() from within your app, then finally individual Auth.federatedSignIn({ provider: 'Google' }) buttons.

@haruharuharuby
Copy link

@ericclemmons (CC: @YahngSungho )

I could resolve it myself in my case.
My problem resulted from a shortage of Cognito Identity Provider.
I needed to add UserPoolId and ClientId to IdentityProvider.
Because I configured the aws-exports.js to specify existed UserPool and Identity Provider and I added a new Client on only UserPool configuration.

I compared UserPool and Cognito Idp configuration between existing one and newly deployed one which published by calling "amplify add auth".

It may fix if @YahngSungho's configuration is the same.
screenshot

@ericclemmons ericclemmons added the pending-close-response-required A response is required for this issue to remain open, it will be closed within the next 7 days. label May 18, 2020
@stale
Copy link

stale bot commented May 25, 2020

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.

@stale stale bot closed this as completed May 25, 2020
@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working pending-close-response-required A response is required for this issue to remain open, it will be closed within the next 7 days. React React related issues
Projects
None yet
Development

No branches or pull requests

4 participants