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
I think this is the same problem I was running in to. https://discord.com/channels/839993398554656828/1185407818900185089
@Rick Are you using Express?
nextjs actually. i’ll drop in the code when i’m back
@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.are you setting that though?