Created
September 26, 2022 16:59
-
-
Save flybayer/0a70d2ae2dc5fae80071076a95abfc7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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