supabase
supabase copied to clipboard
how to getSession with serverSupabaseClient?
Is there another header I need to provide in order for serverSupabaseClient to find a session?
I have the following server middleware:
import { serverSupabaseClient } from '#supabase/server'
export default eventHandler(async (event) => {
const client = serverSupabaseClient(event)
const { data } = await client.auth.refreshSession()
console.log('headers', event.node.req.headers)
console.log('CLIENT SESSION', data)
})
my output always looks like this:
headers { 6:59:02 PM
'sec-fetch-site': 'same-origin',
'sec-fetch-mode': 'cors',
'sec-fetch-dest': 'empty',
cookie: 'sb-access-token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoZW50aWNhdGVkIiwiZXhwIjoxNjg5NjQ5MDc3LCJzdWIiOiJlZjlmMzM3Yy05N2Y3LTRiOWYtYmI1Zi04ZjRlMWQ2OTY4ZDEiLCJlbWFpbCI6ImFwcC1hZG1pbi1zdXBlckBleGFtcGxlLmNvbSIsInBob25lIjoiIiwiYXBwX21ldGFkYXRhIjp7InByb3ZpZGVyIjoiZW1ha..............truncated',
CLIENT SESSION { user: null, session: null } 6:59:02 PM
...
}
i can manually parse the cookie down the chain.