https://supabase.com/ logo
#help
Title
# help
y

YelloJello

10/06/2021, 5:11 PM
What exactly should you do when your JWT has expired? How do you go about fetching a new one? EDIT: There's an undocumented method called refreshAccessToken, but how would I go about detecting that my current JWT has expired, so i can refresh my JWT silently?
m

Mihai Andrei

10/06/2021, 6:12 PM
If you decode it, you can see when it is going to expire
y

YelloJello

10/06/2021, 6:49 PM
how would i go about actually refreshing the token though? aka how do I know that I should refresh my token? ex: the JWT would expire in 15 mins, how would I refresh it before then
isn't this the kinda thing the library should handle tho?
m

Mihai Andrei

10/06/2021, 6:56 PM
If you use supabase js, it handles by itself
You dont need to refresh it
y

YelloJello

10/06/2021, 6:56 PM
but it would error out randomly that my jwt is expired every now and then
I'm currently using supabase-js v1.21.0
m

Mihai Andrei

10/06/2021, 7:00 PM
Hmm, Im not sure. I never received an error for the expired token using supabase-js
Maybe someone else knows
y

YelloJello

10/06/2021, 7:01 PM
do you also set an auth cookie? could that have something to do?
m

Mihai Andrei

10/06/2021, 7:09 PM
I dont. I use it directly from frontend