-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
V6 Federated sign in with Google returns OAuthSignInException #12999
Comments
HI @sriranjanivenkatesan thank you for opening this issue. I've attempted to reproduce it unsuccessfully so far, but wanted to suggest on small but potentially helpful action - since you were upgrading between two major versions, could you try deleting your node_modules as well as package-lock.json file and reinstalling your dependencies if you haven't done so yet? Additionally if you check local storage, can you share what values you see in there that are specific to Amplify Auth? |
hello @nadetastic , thanks for the suggestion. We tried deleting the node_modules,package-lock and reinstalling. But still getting the same issue. cc: @wjcunningham7 |
I am facing the same issue in the same situation. {
"event": "signInWithRedirect_failure",
"data": {
"error": {
"name": "OAuthSignInException",
"recoverySuggestion": "Make sure Cognito Hosted UI has been configured correctly"
}
}
} This is the returned URL params after login with Google
I got a Response: {
"error": "invalid_client"
} Payload:
I keep trying to solve this problem, if I have news I share it here. Looking at this documentation, AWS said that provably the Request header detailed
:authority:
hairqueue-web.auth.us-east-1.amazoncognito.com
:method:
POST
:path:
/oauth2/token
:scheme:
https
Accept:
*/*
Accept-Encoding:
gzip, deflate, br, zstd
Accept-Language:
en-US,en;q=0.9,pt-BR;q=0.8,pt;q=0.7
Content-Length:
312
Content-Type:
application/x-www-form-urlencoded
Origin:
http://localhost:3000
Referer:
http://localhost:3000/
Sec-Ch-Ua:
"Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"
Sec-Ch-Ua-Mobile:
?1
Sec-Ch-Ua-Platform:
"Android"
Sec-Fetch-Dest:
empty
Sec-Fetch-Mode:
cors
Sec-Fetch-Site:
cross-site
User-Agent:
Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Mobile Safari/537.36
X-Amz-User-Agent:
aws-amplify/6.0.18 auth/36 framework/2
should it be a problem? |
I am not having this error anymore. In my case, it was happening because I was using OAuth Google credentials that were automatically created by Firebase authentication. (I don't know exactly the reason for not working with AWS Cognito. The solution for me: I created another credential from scratch (very simple) on the Google Cloud Platform and configured that in AWS Cognito. Result: Now I can sign in using Google Provider and it is correctly generating tokens for the user authenticated. |
hello @sriranjanivenkatesan . Can you confirm if the following flow is valid ? call Also can you confirm if the error you are experiencing is coming from the |
The Also can you test this flow in different browsers, chrome, firefox and safari ? |
Hi @sriranjanivenkatesan wanted to follow up here. Have you had a chance to review the comment from @israx above? |
hello @nadetastic @israx Thanks for your patience:) Tried with chrome and firefox, the issue seems to persist in both. |
It looks that after the login flow, it is not redirecting to the if the Hub.listener logic is on the |
This was the issue I ran into as well. Make sure you have your routes properly defined as a broken route will also throw this same error. Thank you Pedro! |
@sriranjanivenkatesan, can you confirm if your redirect URL's in the Cognito console for the Hosted UI align with the redirect sign in/out in your config? I'm wondering if there's a mismatch between these. And are there any changes (beyond the imports and API names being called) when migrating from v5 to v6? @speedhawk21 and @speedhawk21, thank you for the additional comments and glad to hear you're both unblocked. |
@sriranjanivenkatesan, can you see if upgrading to the latest version of Amplify (or anything after v6.0.23) gives you any different behavior? There were changes to the OAuth flow in that version that could help with the issue here. |
@sriranjanivenkatesan, I came across same issue yesterday, my flow was like:
On my redirect page, I was trying to fetch Session and after success, i was routing myself to main/home page. something like this, NOT EXACT CODE
but i was getting the same error. How I solved it:I changed my redirect signIn url from: mydomain.com/api/redirect from where i was initiating my signIn request and fetchSession there. Possible Issues:
Code Received -> you change your route/perform action -> Oauth Flow completes |
Thank you for the additional context/comment above, @Ikraam-Rasheed! @sriranjanivenkatesan, I'll close out this issue since we haven't heard back from you (but others have commented as resolved). If you are still experiencing this, please feel free to reply back and provide any information previously requested and we'd be happy to re-open the issue. |
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
auth
Backend
None
Environment information
Describe the bug
We migrated our react application from amplify v5.3.4 to v6.0.15
Federated Sign In with google returns the required code and state values post sign in as seen in the below image
But the Hub event returns a
signInWithRedirect_failure
We also added a debugger to capture the error in console which returns the following exception
Note : The federated login for the user works fine using v5.3.4
Expected behavior
Reproduction steps
npm install [email protected]
amplifyconfiguration.json
fileyarn start
and clicked on theSign in with Google
button to trigger the sign in.Code Snippet
Log output
aws-exports.js
Manual configuration
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: