Skip to content

Instantly share code, notes, and snippets.

@flybayer
Created September 26, 2022 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flybayer/0a70d2ae2dc5fae80071076a95abfc7a to your computer and use it in GitHub Desktop.
Save flybayer/0a70d2ae2dc5fae80071076a95abfc7a to your computer and use it in GitHub Desktop.
import { Controller, Get, Req, Res } from '@nestjs/common';
import { Request, Response } from 'express';
import { passportAuth } from "@blitzjs/auth"
const passportHandler = passportAuth({
successRedirectUrl: "/",
errorRedirectUrl: "/",
strategies: [
{
strategy: new PassportStrategy(), // Provide initialized passport strategy here
},
],
})
@Controller('login')
export class LoginController {
@Get('*)
index(@Req() request: Request, @Res() response: Response): string {
return passportHandler(request, response)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment