Able to restore session on middleware but on client side when calling the session returns an error
Answered
New Guinea Singing Dog posted this in #help-forum
New Guinea Singing DogOP
Trying to do this with supabase, so what I have is when the user logs in, the cookie holds their access token and refresh token, and on my middleware script i retrieve it to restore the session. But when I try to call it in my client side component it throws an error 'invalid sub claim'. Anyone done anything like this before?
Answered by New Guinea Singing Dog
Never mind, for anyone else trynna restore sessions from cookies I ended up fixing it by specifically using the middleware-type client for my middleware and a client-type client for my client side (these come from the helper packages). Before i was exporting one base CreateClient() supabase client from one file
1 Reply
@New Guinea Singing Dog Trying to do this with supabase, so what I have is when the user logs in, the cookie holds their access token and refresh token, and on my middleware script i retrieve it to restore the session. But when I try to call it in my client side component it throws an error 'invalid sub claim'. Anyone done anything like this before?
New Guinea Singing DogOP
Never mind, for anyone else trynna restore sessions from cookies I ended up fixing it by specifically using the middleware-type client for my middleware and a client-type client for my client side (these come from the helper packages). Before i was exporting one base CreateClient() supabase client from one file
Answer