Integrate Social Login into your NestJS app seamlessly.
// app.module.ts
import { GoogleAuthModule } from '@nestjs-hybrid-auth/google';
@Module({ import: [ GoogleAuthModule.forRoot({ clientID: process.env.GOOGLE_CLIENT_ID, clientSecret: process.env.GOOGLE_CLIENT_SECRET, requestCallbackURL: process.env.GOOGLE_CALLBACK_URL, }), ],})class AppModule {}
// app.controller.ts
import { UseGoogleAuth } from '@nestjs-hybrid-auth/google';
@Controllerclass AuthController { @UseGoogleAuth() @Get('auth/google') googleLogin() {}
@UseGoogleAuth() @Get('auth/google-callback') googleLoginCallback(req: Request) { console.log(req.hybridAuthResult.user | accessToken | refreshToken); }}
Easy to Use
NestJS Hybrid Auth is just a dynamic module which can be imported inside of your application root module configure it for various identity providers and use the route handlers in your controller.
Multiple Identity Providers
The library contains various social identity providers for e.g. Google, Facebook, Twitter and many more. I will keep updating it with more providers. You just need to configure them in the root module.