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 🙏

© 2026 – Pkg Stats / Ryan Hefner

more-sso-sdk

v1.5.8

Published

SSO login

Readme

🔐 more-sso-sdk

The more-sso-sdk provides a simple and consistent way to integrate Single Sign-On (SSO) into your applications.
It supports both Next.js and Vite projects, offering easy initialization, token handling, and logout functionality.


📦 Installation

npm install more-sso-sdk

or

yarn add more-sso-sdk

📥 Import

import { SSOAuthorization, ENV } from "more-sso-sdk";

⚙️ Initialization

Initialize the SDK at the entry point of your application:

SSOAuthorization.init({
  env: ENV.DEV, // ENV.DEV or ENV.PROD
  redirectUrl: "https://id.dev.more.in/login", // or https://id.more.in/login for PROD
  app: "insight", // your project name
  idp: "https://api.sso.dev.more.in/",
});

🔧 Configuration Options

| Key | Type | Values | Description | | ------------- | -------- | --------------------------------------------------------------- | --------------------------------------------------- | | env | ENV | ENV.DEV | ENV.PROD | Environment mode (development or production). | | redirectUrl | string | https://id.dev.more.in/login https://id.more.in/login | The SSO login page URL. | | app | string | Any string | The name of your project (used for identification). | | idp | string | https://api.sso.dev.more.in/ https://api.sso.more.in/ | SSO server API URL |

🔑 Authentication Methods

1. Get Token (Production / Development)

SSOAuthorization.getToken(redirectURL: string): Promise<string>
  • redirectURL: The URL of your app to redirect back after login.

Example:

const currentUrl = window.location.href;
const encodedRedirect = encodeURIComponent(currentUrl);

SSOAuthorization.getToken(encodedRedirect)
  .then((token) => {
    if (token) {
      setAccessToken(token);
    }
  })
  .catch((error) => {
    console.error("Token fetch failed", error);
  });

2. Get Dev Token (Local Development Only)

SSOAuthorization.getDevToken(username: string): Promise<string>
  • username: Developer username / domain ID.

Example:

SSOAuthorization.getDevToken(process.env.NEXT_PUBLIC_USERNAME as string)
  .then((token) => {
    if (token) {
      setAccessToken(token);
    }
  })
  .catch((error) => {
    console.error("Dev token fetch failed", error);
  });

3. Unified Token Fetch (Recommended)

if (process.env.NODE_ENV === "development") {
  SSOAuthorization.getDevToken(process.env.NEXT_PUBLIC_USERNAME as string)
    .then((result) => {
      if (result) {
        setAccessToken(result);
      }
    })
    .catch((error) => {
      console.error(error);
    });
} else {
  const currentUrl = window.location.href;
  const encodedRedirect = encodeURIComponent(currentUrl);
  SSOAuthorization.getToken(encodedRedirect)
    .then((result) => {
      if (result) {
        setAccessToken(result);
      }
    })
    .catch((error) => {
      console.error(error);
    });
}

🚪 Logout

SSOAuthorization.logout(redirectURL: string): Promise<void>

Example:

SSOAuthorization.logout("https://myapp.com")
  .then(() => {
    console.log("Logged out successfully");
  })
  .catch((error) => {
    console.error("Logout failed", error);
  });

📌 Notes

  • Use ENV.DEV for development and ENV.PROD for production.
  • In local development, prefer getDevToken for faster workflow.

📜 License

MIT © More