For Next.js applications, you need token storage that works in both client and server environments. The built-in CookieTokenStorage only works client-side, so you’ll need a custom implementation:
This pattern ensures your authentication works consistently across Next.js server components, client components, and API routes. The cookie-based approach is recommended for full-stack Next.js applications.