Invalid Refresh Token: Already Used: SSR NextJS
I have used the SSR Auth Guide for setting up auth with NextJS. https://supabase.com/docs/guides/auth/server-side/nextjs?queryGroups=router&router=app
I am seeing that inconsistently my token (set in the browser as a cookie) is becoming invalid. Sometimes I am even seeing the
A weird anecdote is that it only happens on one page/component and I am making probably 10 requests to supabase back to back. My thoughts are it's one of two things:
I am seeing that inconsistently my token (set in the browser as a cookie) is becoming invalid. Sometimes I am even seeing the
Invalid Refresh Token: Already Used message. I don't have anything custom or different about my flow for auth. I have done everything in the guide to a T. Based on searching around I believe that there is a potential problem with the browser client in that it's trying to potentially refresh the token even though the server and middleware already achieve that. I am still testing out a few things.A weird anecdote is that it only happens on one page/component and I am making probably 10 requests to supabase back to back. My thoughts are it's one of two things:
- I am calling the DB too much that it's freaking out the auth system because a token is out of date or in a weird state when I call (and I need to optimize this...)
- Something is happening with the token being set in the cookies that isn't playing nicely with browser side code.