S
Supabase2y ago
M

Supabase Auth with SSR package and Express

Hi all! I'm trying to implement this functionality https://supabase.com/docs/guides/auth/server-side/creating-a-client?framework=express&environment=server-client For some reason, when pass res, req from Express as context, it responds with this error: TypeError: Cannot read properties of undefined (reading 'sb-endpabgnoldzrglfjjes-auth-token') const cookie = cookies[key] ?? ''; i identified that in this line returns undefined: const cookies = context.req.cookies; Does anyone have any idea why? Has anyone implemented it yet? P.S. Does it make sence to use SSR package for server side auth at all, instead of supabasejs?
Creating a Supabase client for SSR | Supabase Docs
Configure Supabase client to use Cookies
5 Replies
Rick
Rick2y ago
I think this is the same problem I was running in to. https://discord.com/channels/839993398554656828/1185407818900185089
M
MOP2y ago
@Rick Are you using Express?
Rick
Rick2y ago
nextjs actually. i’ll drop in the code when i’m back
M
MOP2y ago
@Rick so instead of using const cookies = context.req.cookies const cookie = cookies[key] ?? ''; I decided to get the cookie from context.req.headers.cookie and it worked.
Rick
Rick2y ago
are you setting that though?

Did you find this page helpful?