-
Notifications
You must be signed in to change notification settings - Fork 248
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
Any sort of error causes a infinite redirect chain #122
Comments
The way we're currently working around this issue is parsing URL search params ourselves and when it contains Looking at the code from this repo, the error is being handled internally and should be made visible to the user. Another nit is that the server is returning an English localized string in |
Hi @Empty2k12 - thanks for raising this. In the event of a login error, the hook will return an error which you can use to handle cases like this. If the callback url contains
Are you generating the error on the server from a custom rule (eg https://auth0.com/rules/email-verified)? |
@Empty2k12 ☝️ I've edited the post above: you shouldn't be redirecting to a protected page because the |
I cannot share code at this time, but the setup is quite simplistic. There's only one route, which is the protected one. Any user which is not authenticated will be redirected to the login-page. Seems like this use-case is not supported at this time, can you suggest any workarounds?
Not sure how I missed the
This is indeed the case, from the error it looked like this is a feature from Auth0 rather than a script, but I checked back with the person in charge of setting up Auth0. I will initiate a change which - in our case - returns an enum-error which can be localized vs. a complete error string. |
You'll need a route to handle the callback that isn't protected, eg: const CallbackComponent = () => {
var { error, isLoading } = useAuth();
if (isLoading) return <>Logging you in...</>;
if (error) return <>Verify your email and login again</>;
}
...
<Auth0ProviderWithHistory redirectUri="http://domain/callback">
<Menu />
<Route path="/callback">
<CallbackComponent />
</Route>
<Route path="/">
<ComponentWithwithAuthenticationRequired />
</Route>
</Auth0ProviderWithHistory> |
Closing this, feel free to reopen if you have any other questions |
Describe the problem
While implementing the Auth0 SDK, both email being not verified and script-blocker blocking access to the auth0.com domain is causing an infinite redirect chain with changing tokens.
What was the expected behavior?
Fine-grained error handling capabilities being available, so I can alert my users if the domain is blocked, or if the e-mail needs to be verified. If requests are retried, I'd expect an implementation of exponential back-off preventing rapidly sending requests despite them failing all the time.
Reproduction
Implement auth0-react like described here: https://auth0.com/docs/libraries/auth0-react
Way 1
Create a new user, but don't confirm the e-mail. Log-in and see rapid redirections.
Way 2
Install uMatrix and log-in to the React app. See rapid redirections.
Environment
auth0-react
used: 1.1.0The text was updated successfully, but these errors were encountered: