@nest-hero/next-auth
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Next-auth.js module for Nest framework (node.js)

npm install @nest-hero/next-auth

NextAuth side

export const authOptions: NextAuthOptions = {
    session: {
        strategy: 'jwt',
    }
}

NestJS side

import {NextAuthModule} from '@nest-hero/next-auth';

@Module({
    imports: [
        NextAuthModule.forRoot({
            secret: process.env.NEXTAUTH_SECRET,
            cookieName: 'optional'
        }),
    ],
})
export class AppModule {}
import { NextAuthGuard, User } from '@nest-hero/next-auth';

@Controller()
export class AppController {

    @UseGuards(NextAuthGuard)
    @Post('/')
    handler(@User() user) {
        return user;
    }
}

Diagram

img.png

You can check full example (Nest.JS + Next.JS) at /exmaple folder

Roadmap

  • [x] NextAuth jwt strategy
  • [ ] NextAuth Options Wrapper
  • [ ] NextAuth session table strategy

Readme

Keywords

Package Sidebar

Install

npm i @nest-hero/next-auth

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

113 kB

Total Files

32

Last publish

Collaborators

  • duyld