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

@mowogames/auth-sdk

v0.1.1

Published

TypeScript client for the Mowo Auth OIDC server. Browser + Node, with React hooks.

Downloads

25

Readme

@mowogames/auth-sdk

A tiny, dependency-free TypeScript client for the Mowo Auth OIDC server. Works in any modern browser, Node ≥ 18, the Edge runtime, and Bun.

npm install @mowogames/auth-sdk

Vanilla JS / TS

import { MowoAuthClient } from '@mowogames/auth-sdk';

const auth = new MowoAuthClient({
  issuer: 'https://login.example.com',
  realm: 'main',
  clientId: 'my-app',
  redirectUri: `${location.origin}/callback`,
  postLogoutRedirectUri: location.origin,
});

// On your /callback route:
if (location.pathname === '/callback') {
  await auth.handleCallback();
  history.replaceState(null, '', '/');
}

// Anywhere else:
if (!auth.isAuthenticated()) {
  await auth.signIn();
}

const user = await auth.getUser();
console.log(`Hello ${user.name}`);

auth.fetch(url, init) is a drop-in replacement for fetch that attaches the access token and transparently refreshes it before expiry.

const res = await auth.fetch('/api/whatever');

React

import { MowoAuthProvider, useMowoAuth } from '@mowogames/auth-sdk/react';

function App() {
  return (
    <MowoAuthProvider
      config={{
        issuer: 'https://login.example.com',
        clientId: 'my-app',
        redirectUri: `${window.location.origin}/callback`,
      }}
    >
      <Routes />
    </MowoAuthProvider>
  );
}

function Profile() {
  const { user, isLoading, signIn, signOut } = useMowoAuth();
  if (isLoading) return <p>…</p>;
  if (!user) return <button onClick={() => signIn()}>Sign in</button>;
  return (
    <>
      <p>Hi {user.name}</p>
      <button onClick={() => signOut()}>Sign out</button>
    </>
  );
}

The provider auto-handles the OIDC callback when the browser lands on callbackPath (default /callback) — you don't need a dedicated route, just make sure the path exists and renders something.

Configuration

| field | required | default | description | | ------------------------- | -------- | ---------------------- | ---------------------------------------- | | issuer | ✓ | — | Public origin of your Mowo Auth install. | | clientId | ✓ | — | Your registered OIDC client_id. | | redirectUri | ✓ | — | Where Mowo Auth redirects after sign-in. | | realm | | main | Realm slug. | | postLogoutRedirectUri | | — | Where to land after signOut(). | | scope | | openid profile email | Requested scopes. | | storage | | sessionStorage | Token store. See alternatives below. |

Token storage

By default tokens live in sessionStorage (cleared when the tab closes). Three built-in alternatives:

import {
  defaultStorage,        // sessionStorage; the default
  localStorageStorage,   // persists across tabs and restarts
  memoryStorage,         // in-memory; useful for SSR
} from '@mowogames/auth-sdk';

You can also supply your own — anything matching TokenStorage:

import type { TokenStorage } from '@mowogames/auth-sdk';
const myStorage: TokenStorage = { get, set, clear };

What this SDK does NOT do

  • It does not validate ID tokens. OIDC says clients SHOULD; we follow the Auth0 / NextAuth convention of trusting userinfo instead. If you need real signature verification, do it server-side.
  • It does not store tokens in httpOnly cookies. That's a server-side concern. If you want the BFF pattern, run a thin proxy in your backend and use the access token there.

License

MIT — see LICENSE.md.