Replies: 3 comments 3 replies
-
New question, in the official nextjs-ts-user-management example, the storage is different:
The expiry date is 1 year. It's on localhost domain, not on supabase. Now this seems to be totally different behaviour compared to the simple react-user-management example. Can you tell me where is this specified? I'd like to know if the 1 year keeps growing when refreshes are run or its a fixed time counted from login (by setting the time of my computer it does seem to be growing). |
Beta Was this translation helpful? Give feedback.
-
OK, I'm step-by-step getting to the bottom of this.
Now the expiry time: When using the Now the only question left over, which is basically the most important question: What happens to auth.sessions / refresh_tokens on the server?
Can someone from Supabase comment on this? I've spent a few hours debugging the client behaviour on my own, it'd be so nice if someone could shed some light on the server part. |
Beta Was this translation helpful? Give feedback.
-
Hey @hyperknot, thanks for all your questions. We're a small team and it takes a while to get to discussions. Regarding persistence:
Regarding session control:
Regarding sessions / refresh_token tables:
|
Beta Was this translation helpful? Give feedback.
-
Hi, I'd like to ask for some clarification about the authentication behaviour and to document exactly how does state persistence works in Supabase. I'd really like to choose Supabase over Firebase for a new project but this honestly feels missing from documentation and from general attention. I understand that there are fantastic new features being shipped every month, but please give some attention to the core Auth functionality.
I believe what people want is users to never be logged out on a website which uses Supabase. This has been the standard behaviour across industry (e.g. Facebook etc. would panic if their users are logged out automatically). Firebase actually has a page which documents fine grained controls over this behaviour.
It seems a lot of users are confused about this here, there are dozens of discussions popping up at regular intervals about "why are my users being logged out", "how to make sure no one ever gets logged out automatically", etc.
Also, this "JWT expiry limit" section couldn't be more confusing, almost everyone believes that this means how long are users logged in, and set it to 1 week and worry that even one week is too little.
My questions (very basic client side JS scenario, tested on react-user-management example).
localStorage contains both of these values inside but it contains two expires_ values, 1 hour by default. What does this mean, what happens after it expires? localStorage never gets deleted by the JS lib (I hope) right? I mean can I conclude that refresh_token is forever lived on the client side?
What happens to the auth.refresh_tokens table? This has to be cleaned-up from time to time, I guess based on the "updated_at" column. But I couldn't find anything in the documentation or settings regarding this. This should be the most important information on the Auth control panel. Much more important than the "JWT expiry limit" field, which just confuses people.
Finally, when using axios, etc. to make external API requests sending JWT tokens, what is the way to manually refresh the JWT token using the refresh token? I guess the code should be something like
Beta Was this translation helpful? Give feedback.
All reactions