Why I am not able to get the cookies in route handlers? (App Dir)
Unanswered
sourab posted this in #help-forum
sourabOP
Here's the config of the cookie I am setting when user logs in
This encryptedToken contains refresh token to rotate user's token when needed.
In my refresh token route handler file I am trying to access the AUTH_COOKIE but getting null. Any idea why?
cookies().set(AUTH_COOKIE, encryptedToken, {
secure: process.env.NODE_ENV !== 'development',
httpOnly: true,
path: '/',
maxAge: 7 * 24 * 3600000,
sameSite: 'lax',
});This encryptedToken contains refresh token to rotate user's token when needed.
In my refresh token route handler file I am trying to access the AUTH_COOKIE but getting null. Any idea why?
const sessionToken = cookies().get(AUTH_COOKIE)?.value1 Reply
sourabOP
@joulev @Western harvester ant can you guys take look? Please