AmplifyAuthenticator stuck in loading state after refresh
See original GitHub issueDescribe the bug
After signing in with hosted UI, I am redirected to my React App and signed in.
But the first time I refresh the page, I am stuck in loading
state, no AuthStateChange gets fired.
And yet, if I refresh again, I am signed in and it does not happen anymore for the session.
To Reproduce Steps to reproduce the behavior:
- Use
AmplifyAuthenticator
from@aws-amplify/ui-react
- Sign in from cognito hosted ui
- Refresh
Expected behavior I should stay signed in even after a simple refresh.
Additional context Here are the console logs in DEBUG:
[DEBUG] 01:26.759 Hub - Dispatching to auth with {event: "parsingCallbackUrl", data: {…}, message: "The callback url is being parsed"}data: {url: "http://localhost:3000/app/"}event: "parsingCallbackUrl"message: "The callback url is being parsed"__proto__: Object
[DEBUG] 01:26.760 Hub - Dispatching to auth with {event: "parsingCallbackUrl", data: {…}, message: "The callback url is being parsed"}
[DEBUG] 01:26.763 AnalyticsClass - on hub capsule auth {event: "parsingCallbackUrl", data: {…}, message: "The callback url is being parsed"}
[DEBUG] 01:26.764 Hub - Dispatching to auth with {event: "parsingCallbackUrl", data: {…}, message: "The callback url is being parsed"}
[DEBUG] 01:26.764 Hub - Dispatching to auth with {event: "configured", data: null, message: "The Auth category has been configured successfully"}
[DEBUG] 01:26.765 Hub - Dispatching to auth with {event: "configured", data: null, message: "The Auth category has been configured successfully"}
[DEBUG] 01:26.765 AnalyticsClass - on hub capsule auth {event: "configured", data: null, message: "The Auth category has been configured successfully"}
[DEBUG] 01:26.766 Hub - Dispatching to auth with {event: "configured", data: null, message: "The Auth category has been configured successfully"}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:13 (7 by maintainers)
Top Results From Across the Web
AmplifyAuthenticator stuck in loading state after refresh
After signing in with hosted UI, I am redirected to my React App and signed in. But the first time I refresh the...
Read more >AuthStatus is not changing from configuring state using ...
Flicker of login page on Authentication - useAuthenticator - React - Amplify Auth. Unfortunately now, the page is always stuck in the " ......
Read more >Refreshing page cause "loading..." stuck forever
Hello, I am building a React app based on React quickstart found here on Auth0 docs . Login/Logout and token generation/retrieval from ...
Read more >The Complete Guide to User Authentication with the Amplify ...
We can check for the status of a currently signed in user at any time using the Auth class from Amplify. Let's update...
Read more >Complete Guide to Amplify and Next.js - Enlear Academy
The Amplify Framework provides the following services. ... If you are stuck at some point, you can refer to this original guideline on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am also experiencing this with the following dependancies and Angular.
What seams to be happening is that the authenticator component checks if the page has been loaded from Cognito Hosted ui here - https://github.com/aws-amplify/amplify-js/blob/main/packages/amplify-ui-components/src/components/amplify-authenticator/amplify-authenticator.tsx#L88
byHostedUi
in this situation is'true'
andcheckUser()
is never called. Hence the component gets stuck inloading
stateI opened #8357 to address this issue.