next-auth-cookie-fix
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

next-auth-cookie-fix

A library to monkey-patch NextAuth to use Session cookies via Next.js middleware.

This allows to force the session-token cookies to only have Session level expiry. This is needed because it's not provided by NextAuth by default: https://github.com/nextauthjs/next-auth/pull/4693

How to use:

  1. add the library npm install next-auth-cookie-fix
  2. add the following middleware to your app:
     import { setAuthCookieExpiryToSession } from 'next-auth-cookie-fix';
    
     export const middleware = setAuthCookieExpiryToSession;
    
     // this needs to only match the document queries
     export const config = { matcher: ['/'] };
    

Readme

Keywords

none

Package Sidebar

Install

npm i next-auth-cookie-fix

Weekly Downloads

1

Version

0.0.5

License

MIT

Unpacked Size

4.64 kB

Total Files

8

Last publish

Collaborators

  • kidra