nest-hero / next-auth

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

Home Page:https://www.npmjs.com/package/@nest-hero/next-auth

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  • NextAuth jwt strategy
  • NextAuth Options Wrapper
  • NextAuth session table strategy

About

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

https://www.npmjs.com/package/@nest-hero/next-auth

License:MIT License


Languages

Language:TypeScript 83.3%Language:JavaScript 16.0%Language:CSS 0.7%