User is logged out quite quickly
Hi there, is there a way to avoid that users are logged out quite quickly?
Often, it happens that users have to log in again after a short time.
6 Replies
Hi @mb23. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. The provided knowledge sources do not contain information about session duration or how to adjust the time before a user is automatically logged out in Wasp.
However, this could be related to the configuration of JWT (JSON Web Tokens) used for authentication. Typically, these tokens have an expiry time after which they are no longer valid, and the user would need to log in again.
I would recommend checking the Wasp documentation or the project's GitHub issues for more information on this topic.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @mb23, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?
What do you mean by quite quickly? π
@miho sorry, after 3 minutes or so π
Hmmm, could you open the browser dev tools and see what is going on when that happens? Maybe some request is made to the server and you get a
401
error?
Usually, the token in the local storage should be valid for 1 hour, but we have a system on the client that deletes the token if some of the requests fails with 401
and want to improve that: https://github.com/wasp-lang/wasp/issues/1227GitHub
Revisit auth token clearing behavior on 401 responses Β· Issue #1227...
Currently, when we get a 401 response, we clear the auth token: wasp/waspc/data/Generator/templates/react-app/src/api.ts Lines 36 to 41 in 226ec39 api.interceptors.response.use(undefined, (error) =...
@miho ah, thanks, the 401 might be the problem! Is there any way to change this behaviour on my end?
Which endpoint is returning 401? π one of your custom endpoints or something from Wasp?