feat: github login added

This commit is contained in:
Balu Babu
2023-01-13 02:11:42 +05:30
parent 1f581e7b51
commit 311ab67ebe
6 changed files with 91 additions and 2 deletions

View File

@@ -65,4 +65,16 @@ export class AuthController {
if (E.isLeft(authTokens)) throwHTTPErr(authTokens.left);
authCookieHandler(res, authTokens.right, true);
}
@Get('github')
@UseGuards(AuthGuard('github'))
async githubAuth(@Request() req) {}
@Get('github/callback')
@UseGuards(AuthGuard('github'))
async githubAuthRedirect(@Request() req, @Res() res) {
const authTokens = await this.authService.generateAuthTokens(req.user.id);
if (E.isLeft(authTokens)) throwHTTPErr(authTokens.left);
authCookieHandler(res, authTokens.right, true);
}
}