You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I'm creating some cookies when user login in my app, to use these cookies for validate if user is logged in before access some page of my app. It was working, but suddenly my cookies stopped appearing inside getServerSideProps. I don't know why.
1 - I set the cookies inside login function nookies.set(null, 'userAddress', res.data.result.address, { maxAge: 60 * 60 * 24, }) nookies.set(null, 'userSessionToken', res.data.result.sessionToken) setCookie(null, 'userAddress', res.data.result.address, { maxAge: 60 * 60 * 24, }) setCookie(null, 'userSessionToken', res.data.result.sessionToken)
2 - I try to get this cookies inside a page getServerSideProps
`
export const getServerSideProps: GetServerSideProps = async (ctx) => {
const cookies = nookies.get(ctx)
console.log('cookies => ', cookies)
Hey, I'm creating some cookies when user login in my app, to use these cookies for validate if user is logged in before access some page of my app. It was working, but suddenly my cookies stopped appearing inside getServerSideProps. I don't know why.
1 - I set the cookies inside login function
nookies.set(null, 'userAddress', res.data.result.address, { maxAge: 60 * 60 * 24, }) nookies.set(null, 'userSessionToken', res.data.result.sessionToken) setCookie(null, 'userAddress', res.data.result.address, { maxAge: 60 * 60 * 24, }) setCookie(null, 'userSessionToken', res.data.result.sessionToken)
2 - I try to get this cookies inside a page getServerSideProps
`
export const getServerSideProps: GetServerSideProps = async (ctx) => {
const cookies = nookies.get(ctx)
console.log('cookies => ', cookies)
if (cookies.userAddress?.length > 0) {
const isSessionTokenExpired = await verifyUserSessionTokenIsExpired(
cookies.userAddress,
cookies.userSessionToken,
)
} else {
return {
props: {},
redirect: {
destination: '/dashboard/investors',
},
}
}
}`
3 - Cookies does not appear anymore =>
The text was updated successfully, but these errors were encountered: