Supabase Auth without middleware

Hello! Thank you for supabase, it is really awesome. A small question. I tried to look over similar questions but i'm confused. Is it possible to use supabase-auth in nextjs without the middleware? I know in rsc, you cannot set cookies, so not sure what happens if your token expired and supabase tries to refresh it but it fails to set the cookie. Is there any workaround to skip middleware? Thank you!
1 Reply
silentworks
silentworks5d ago
You can set cookies in route handlers and server actions, so in theory you could check if the token is about to expire (note the token is saved in the cookie) and send a request to the route handler to refresh it. I said in theory because I haven't had time to test this out as yet myself.

Did you find this page helpful?