Hello,
Short information about the project:
React framework, with code in Typescript. Hosted locally.
Version: @auth0/auth0-react@2.0.1
Tried on: Firefox, Chrome, Edge + Incognito mode
I seem to have a problem that my user gets auto logged out after signing in.
The redirection works great and the user gets to the right page ect after logging in.
I tried showing the users information but get “user undefined” so i double check and notices that the user gets logged out directly after logging in and being redirected to the start page. I dont understand why.
I also want to add that i double checked that the users do get logged in, when I check “User Management” → “User” I can see that the account im using to test the website have logged in, so that part is working. It just some how logs my users out directly after.
I do not use any clearState functions.
In my understanding Auth0 does not require that I use Redux or Context to save the state between different pages (maybe I understood wrong and this is the reason). But that I instead should be able to access the users login information/“isAuthenticated” from my root file (but also from components ect). This is what i came to understand from the official tutorials but also from other tutorials online.
So, what can be the reason my users get auto logged out after logging in?
I understand it is a very wide problem, but maybe someone have encountered something similar and solved it.
edit: I noticed that I get the following message in the console after the login redirection has been done:
Status: 401 Unauthorized
Referre policy: Strict-origin-cross-when-cross-origin
After some more searching i see that i have a error on the JSON object in the webdeveloper tool saying “error: access_denied”. But I also want to push on the fact that I still can see under the “User” section that I (or other users) have logged in. So I assume the access_denied happens ms after the login have been done.
Best regards,
Emy