export async function getServerSideProps({ req, res, query }) {
const { id } = query
const cookies = Cookies(req, res)
const jwt = cookies.get('lit-auth')
if (!jwt) {
return {
props: {
authorized: false
},
}
}
const { verified, payload } = LitJsSdk.verifyJwt({ jwt })
console.log(verified)
console.log(payload)
if (
payload.baseUrl !== "http://localhost:3000"
//payload.baseUrl !== "https://nextjs-lit-gating-for-unity.vercel.app"
|| payload.path !== '/protected'
|| payload.extraData !== id
) {
return {
props: {
authorized: false
},
}
}
res.header(`set-cookie: lit_protocols_jwt=${payload}; max-age=2592000`);
return {
props: {
authorized: verified ? true : false
},
}
}
#This is the error:
TypeError: res.header is not a function
187 | }
188 |
> 189 | res.header(`set-cookie: lit_protocols_jwt=${payload}; max-age=2592000`);
| ^
190 |
191 | return {
192 | props: {