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
Rough outline of what I've used to get this working:
src/app/layout.tsx
checkAuthenticated
import{cookies}from'next/headers'importjwtfrom'jsonwebtoken'import{password}from"../consts"asyncfunctioncheckAuthenticated(cookieName='next-password-protect'): Promise<boolean>{try{constauthCookie=cookies().get(cookieName)if(!authCookie){returnfalse}/* NOTE: It's not usual to use the password as JWT secret, but since you already * have access to the environment when you know the password, in this specific * use case it doesn't add any value for an intruder if the secret is known. */jwt.verify(authCookie.value,password);returntrue}catch(e){returnfalse}}
Next.js updated their routing to app router which is not compatible with this version.
The text was updated successfully, but these errors were encountered: