OAuth2 & Social Auth Flows
Configure social login and OAuth2 authentication.
Supported Providersβ
| Provider | Strategy | Status |
|---|---|---|
| OAuth2 | Built-in | |
| GitHub | OAuth2 | Built-in |
| OAuth2 | Built-in | |
| OAuth1.1a | Built-in | |
| Microsoft | OAuth2 | Built-in |
| OAuth2 | Built-in |
OAuth2 Flowβ
Configurationβ
# Google
GOOGLE_CLIENT_ID=your-client-id
GOOGLE_CLIENT_SECRET=your-client-secret
GOOGLE_CALLBACK_URL=http://localhost:3000/api/auth/google/callback
# GitHub
GITHUB_CLIENT_ID=your-client-id
GITHUB_CLIENT_SECRET=your-client-secret
GITHUB_CALLBACK_URL=http://localhost:3000/api/auth/github/callback
# Facebook
FACEBOOK_CLIENT_ID=your-app-id
FACEBOOK_CLIENT_SECRET=your-app-secret
FACEBOOK_CALLBACK_URL=http://localhost:3000/api/auth/facebook/callback
Implementationβ
@UseGuards(AuthGuard('google'))
@Get('google')
async googleAuth() {}
@UseGuards(AuthGuard('google'))
@Get('google/callback')
async googleAuthCallback(@Req() req) {
return this.authService.socialLogin(req.user, 'google');
}
Related Pagesβ
- JWT Deep Dive β token management
- SSO with SAML β enterprise SSO
- Authentication API β auth API