0

I am using Next.js 13 and Supabase v2. I have generated an access token fine, the problem it is unreadable or inaccessible due to the fact that the automatically generated access token is not set to the domain "localhost".

Sharing my screenshot for further details:

Has anyone experienced this and been able to find a workaround?

https://i.stack.imgur.com/yZb18.png)

I'm trying to implement authentication via Next.js middleware. However I haven't found a way to correctly access the cookies, it's always undefined or empty or not able to read, except if I access it on the client side. (https://i.stack.imgur.com/3krpi.png)

Gavi Salcedo
  • 9
  • 1
  • 5

2 Answers2

0

Supabase doesn't store the access token on cookies, but instead stores them on local storage. There is a Next.js auth helpers for Supabase to store the access token on cookies and access them on the server side. https://supabase.com/docs/guides/auth/auth-helpers/nextjs

dshukertjr
  • 15,244
  • 11
  • 57
  • 94
0

I found the solution....

Upon investigating it is required to wrap your component in between

Reference:

Gavi Salcedo
  • 9
  • 1
  • 5
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 06 '23 at 21:09