Skip to content

Instantly share code, notes, and snippets.

@workfel
Created October 15, 2018 14:17
Show Gist options
  • Save workfel/03441543aec48950e5fc44e28b6b383e to your computer and use it in GitHub Desktop.
Save workfel/03441543aec48950e5fc44e28b6b383e to your computer and use it in GitHub Desktop.
nest auth auth.module
export class AuthModule implements NestModule {
public configure(consumer: MiddlewaresConsumer) {
consumer
// Saving the socketId on session
.apply(SessionAuthMiddleware).forRoutes('/auth/google')
// Authenticate to google signin api for /auth/google route
.apply(StrategyMiddleware).with({ provider: 'google' }).forRoutes('/auth/google')
// After signin google call this endpoint
.apply(StrategyCallbackMiddleware).with({ provider: 'google' }).forRoutes('auth/google/callback');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment