The auth module contains all the functionality required to authentication users, including SSO.


Import the module into your application:

import { forwardRef, Module } from '@nestjs/common'
import { AuthModule } from '@juicyllama/core'

    imports: [forwardRef(() => AuthModule)],
export class AppModule {}

Out of the box, this will add all the authentication endpoints to your application.

Single Sign On (SSO)

The application supports SSO via the following providers:


Google SSO

  1. Create a new project in the Google Cloud Console

  2. Set up the Oauth consent screen

  3. Add the following scopes:
    • .../auth/
    • .../auth/userinfo.profile

  4. Create a new OAuth 2.0 Client ID

  5. Add your Javascript origins e.g. https://api.<your-domain> for your backend API application

  6. Add the frontend redirect URI (must point to the login page) e.g. https://app.<your-domain>/login for the frontend application

  7. Follow the verification process to make the app public if you need to

  8. Add the following environment variables to your application:
GOOGLE_LOGIN_SCOPES='email profile' # space separated scopes. if not provided "email profile" will be used as default
  1. To show the Google SSO button on the frontend, add the following environment variables to your frontend application:
For customizing how the Google SSO button looks, see the Frontend Auth Docs

Docs v.0.14.0 Copyright © 2024