# Getting Started

# Install using NPM

Open your terminal, and go to the project where you want to use cs-sso-client. Run the following to install this package:

$ npm i @211la/cs-sso-client --save

# Backend Integration

The SSO client is written for your app's backend. It's designed to perform cookie/session-based authentication.

Currently, Nest and Koa frameworks are supported. Follow the relevant guide to integrate SSO Client into your app.

After the installation, SSO Client will add the following endpoints to your application:

  • /sso/login Redirects the user to CS SSO login flow.
  • /sso/logout Terminates the current SSO session.
  • /sso/callback Handles the callback from the SSO service and starts a session in your app.

# Login

To authenticate a user redirect them to:

http://your-app.com/sso/login

# Logout

To end a session, navigate to:

http://your-app.com/sso/logout

This will end both the local session, and the single sign-on session.

# NexusProfile (User)

SSO Client will provide the user data that represents a Nexus211 profile after authentication.

// ..
class NexusProfile {
  public id: string; // nexus211 profile id
  public name: string; // nexus211 first name & last name
  public email: string; // nexus211 profile email

  // nexus211 organization id and name
  public organization: {
    id: string;
    name: string;
  };

  // roles of this profile in nexus211.
  // possible options:
  // owner, admin, member, contact
  public roles: string[];

  // ..
}