npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sso-sunbird-helper

v1.0.18

Published

The sso-sunbird-helper npm package is a comprehensive toolkit designed to streamline and simplify the implementation of State Sign-On (SSO) flows within the Sunbird Education platform. This package offers a range of utility functions, tools, and resources

Downloads

48

Readme

Sunbird-SSO-Helper

Introduction

The sso-sunbird-helper package is a utility tool designed to simplify the integration of State Sign-On (SSO) with Sunbird-ed, an open-source learning platform. It provides developers with streamlined functions and methods to facilitate the implementation of SSO authentication within their applications. Sunbird SSO Flow Diagram

Installation

To get started with sso-sunbird-helper, you need to install the package using either npm or yarn package managers:

Using npm:

npm install sso-sunbird-helper

Using yarn:

yarn add sso-sunbird-helper
  • initializeRoute: This function is used to initiate the State Sign-On (SSO) login process for a user. To log in a user, the client must provide a link that makes a GET request to the auto-login endpoint /v2/user/session/create?token=<jwt_token>, where <jwt_token> is the JSON Web Token (JWT) representing the user's authentication.
  • handleVerifiedContactRoute: Use this function to handle the route that deals with verified contact information. After a user's contact information has been verified during the SSO process, this function is responsible for managing the flow and actions associated with it.
  • handleSuccessRedirect: This function is used When a user successfully authenticates via SSO and is already registered in your application, this function is configured to redirect the user directly to a resource page.It streamlines the user experience by skipping redundant registration steps.

Importing the Package

You can incorporate the necessary methods from the package into your project using either CommonJS or ES6 module syntax.

CommonJS Syntax

If your project utilizes CommonJS modules, import the methods into your JavaScript file as demonstrated below:

const { initializeRoute, handleVerifiedContactRoute, handleSuccessRedirect } = require('sso-sunbird-helper/src');

ES6 Module Syntax

For projects that support ES6 modules, use the following syntax to import the methods:

import { initializeRoute, handleVerifiedContactRoute, handleSuccessRedirect } from 'sso-sunbird-helper/src';

Integration into Existing ssoRoutes.js

In your ssoRoutes.js file in your Sunbird Ed project, you can integrate the SSO functionality into this existing file. Here's how to do it:

  1. Open your existing ssoRoutes.js file located at src/app/routes/ssoRoutes.js.

  2. Add the following code to your existing ssoRoutes.js file:

// Import methods from sso-sunbird-helper
const { initializeRoute, handleVerifiedContactRoute, handleSuccessRedirect } = require('sso-sunbird-helper/src');

// Initialize SSO route
app.get('/v2/user/session/create', initializeRoute());

// Handle verified contact route
app.get('/v1/sso/contact/verified', handleVerifiedContactRoute());

// Handle success redirect route
app.get('/v1/sso/success/redirect', handleSuccessRedirect());
  1. Save the changes to your ssoRoutes.js file.

Example Routes

  • /v2/user/session/create: Initializes the SSO route.
  • /v1/sso/contact/verified: Handles the verified contact route.
  • /v1/sso/success/redirect: Handles the success redirect route.

Make sure to configure your Express app and routes accordingly to suit your project's needs.

By following these steps, you can seamlessly incorporate the functionalities of the sso-sunbird-helper package into your project, facilitating the integration of SSO authentication within your Sunbird-ed applications.