Skip to content

Latest commit

 

History

History
52 lines (43 loc) · 944 Bytes

README.md

File metadata and controls

52 lines (43 loc) · 944 Bytes

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