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

@newgameplusinc/odyssey-sso

v2.2.6

Published

Browser SDK for Odyssey SSO Service, handling authentication, user profile, and resource management.

Downloads

1,112

Readme

Odyssey SSO SDK

The Odyssey SSO SDK provides an easy way to integrate Single Sign-On (SSO) functionality, user profile management, and resource management (Cloths, Materials, Skulls) in your browser-based applications.


Installation

npm install @newgameplusinc/odyssey-sso

Usage

import SSO from "@newgameplusinc/odyssey-sso";

const sso = new SSO({
  sdkKey: process.env.NEXT_PUBLIC_SDK_KEY,
  debug: true,
});

// Login
sso.login("https://your-app.com/redirect");

// Exchange token from URL and get profile (put it in the root component so that it has access to the url all the time)
const user = await sso.exchange();

// Fetch user profile
const profile = await sso.fetchProfile();

// Refresh token
const tokens = await sso.refresh();

// Logout
await sso.logout();

// Listen to SDK events
sso.onEvents((event) => {
  console.log("SSO Event:", event);
});

SDK Configuration

| Field | Type | Description | | -------- | ------- | ---------------------------- | | sdkKey | string | Your SSO SDK key | | debug | boolean | Enable debug logs (optional) |


Methods

login(redirectUrl: string): Promise<void>

Redirects the user to the SSO login page.

  • Parameters:

    • redirectUrl — URL to redirect after login

exchange(): Promise<{ tokens; userData } | undefined>

Exchanges the SSO token from the URL for access/refresh tokens and stores the profile locally.

  • Returns: User profile + tokens or undefined if exchange fails

fetchProfile(): Promise<Profile | undefined>

Fetches the user profile from the SSO server.

  • Returns: Profile object

refresh(): Promise<{ accessToken: string; refreshToken: string } | undefined>

Refreshes the access token using the stored refresh token.

  • Returns: Updated tokens

logout(): Promise<boolean | undefined>

Logs out the user from the SSO server and clears local storage.

  • Returns: true on success

onEvents(cb: Cb)

Subscribe to SDK events. The cb callback will be called with an event object containing a type and payload.

Event types:

  • login — user logged in
  • logout — user logged out
  • refresh — token refreshed
  • profile.fetch — profile fetched
  • profile.update — profile updated
  • profile-photo.update — avatar updated

Cloth events:

  • cloth.add — cloth added
  • cloth.fetch-all — all cloths fetched
  • cloth.fetch — single cloth fetched
  • cloth.update — cloth updated
  • cloth.delete — cloth deleted

Material events:

  • material.add — material added
  • material.fetch-all — all materials fetched
  • material.fetch — single material fetched
  • material.update — material updated
  • material.delete — material deleted

Skull events:

  • skull.add — skull added
  • skull.update — skull updated
  • skull.fetch-all — all skulls fetched
  • skull.fetch — single skull fetched
  • skull.delete — skull deleted

Profile Management

profileUpdate(payload: UpdateProfilePayload)

Update user profile.

avatarUpdate(file: File)

Update user avatar by uploading a File.


Cloth Management

  • clothAdd(payload: AddClothFilePayload)
  • clothGetAll(options?: GetClothsOptions)
  • clothGetById(clothId: string)
  • clothUpdate(clothId: string, payload: UpdateClothPayload)
  • clothDelete(clothId: string)

All methods handle file uploads and token refresh automatically.


Material Management

  • materialAdd(payload: AddMaterialFilePayload)
  • materialGetAll(options?: GetMaterialsOptions)
  • materialGetById(materialId: string)
  • materialUpdate(materialId: string, payload: UpdateMaterialPayload)
  • materialDelete(materialId: string)

Skull Management

  • skullAdd(payload: AddSkullFilePayload)
  • skullGetAll()
  • skullGetById(skullId: string)
  • skullUpdate(skullId: string, payload: UpdateSkullPayload)
  • skullDelete(skullId: string)

Notes

  • This SDK is browser-only. All methods check for the browser environment.
  • Uses a local database (IndexedDB) to store tokens and user profile for session persistence.
  • Automatically handles token refresh for API requests.