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

@gosso/client

v0.1.1

Published

Browser SDK for Gosso OAuth/OIDC SPA clients.

Readme

@gosso/client

Browser SDK for Gosso OAuth/OIDC single-page application clients.

@gosso/client provides the protocol and account self-service layer for ordinary Gosso clients:

  • Authorization Code + PKCE redirects and callback handling
  • token storage, userinfo loading, logout, and automatic refresh
  • authenticated apiFetch with bearer headers and 401 retry
  • username/password login, MFA verification, and passkey login
  • profile, password, email, MFA, passkey, and session management APIs

The package intentionally does not ship React UI. Build app-specific pages with your own design system and call the SDK methods underneath.

Install

npm install @gosso/client

Quick Start

import { createGossoClient } from '@gosso/client';

export const gossoClient = createGossoClient({
  issuer: window.location.origin,
  clientId: 'blog-spa',
  redirectUri: `${window.location.origin}/callback`,
  scope: 'openid profile email',
  postLoginDefaultPath: '/admin',
  loginPath: '/login',
  storagePrefix: 'my-app',
});

Start an OIDC flow:

await gossoClient.redirectToAuthorize('/admin');

Handle the callback route:

const code = new URLSearchParams(location.search).get('code');
const state = new URLSearchParams(location.search).get('state');

if (!code || !state) throw new Error('Missing callback parameters');

const { redirectTo } = await gossoClient.handleRedirectCallback(code, state);
location.href = redirectTo;

Call protected APIs:

const response = await gossoClient.apiFetch('/api/posts', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ title: 'Hello Gosso' }),
});

Password, MFA, and Passkey Login

const result = await gossoClient.loginWithPassword(username, password);

if (result.requires_mfa) {
  await gossoClient.verifyMfa(String(result.mfa_token), code);
}
await gossoClient.loginWithPasskey();

Account Settings

await gossoClient.updateProfile('New Display Name');
await gossoClient.changePassword(currentPassword, newPassword);
await gossoClient.requestEmailChange(newEmail, password);
await gossoClient.confirmEmailChange(newEmail, code);

const mfaStatus = await gossoClient.getMfaStatus();
const passkeys = await gossoClient.listPasskeys();
const sessions = await gossoClient.listSessions();

Configuration

interface GossoClientConfig {
  issuer: string;
  clientId: string;
  redirectUri: string;
  scope: string;
  postLoginDefaultPath: string;
  loginPath: string;
  storagePrefix: string;
  fetchImpl?: typeof fetch;
  onAuthRequired?: () => void;
  onSessionChanged?: (snapshot: SessionSnapshot) => void;
}

Use a unique storagePrefix for each SPA on the same origin to avoid token collisions.

Security Notes

  • Use Authorization Code + PKCE for browser clients.
  • Serve production clients over HTTPS.
  • Keep the Gosso issuer and app behind a same-origin gateway when possible.
  • Tokens are stored in browser localStorage and mirrored to an access_token cookie for same-origin Gosso redirects. Treat XSS prevention as part of your security boundary.

License

MIT