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

@genation/sdk-client

v0.4.2

Published

OAuth 2.1 client for browser and SPA applications. Uses PKCE-only flow — no `client_secret` needed.

Readme

@genation/sdk-client

OAuth 2.1 client for browser and SPA applications. Uses PKCE-only flow — no client_secret needed.

Installation

npm install @genation/sdk-client

Requirements

  • Browser environment (vanilla JS, React, Vue, Svelte, Next.js, React Native...)
  • OAuth 2.1 compatible authorization server

Quick Start

import { createPublicClient } from "@genation/sdk-client";

const client = createPublicClient({
    clientId: "your-client-id",
    redirectUri: "http://localhost:3000/callback",
});

// Listen to auth state changes
client.onAuthStateChange((event, session) => {
    if (event === "SIGNED_IN") {
        console.log("Welcome!", session?.user);
    }
});

// Start login — redirects to auth server
window.location.href = await client.signIn();

Handle the callback

On your /callback page:

await client.handleCallback(window.location.href);
// Redirects back to the page before login

Check session

const session = await client.getSession();
if (session) {
    console.log(session.user.email);
}

Sign out

await client.signOut();

Configuration

createPublicClient({
    clientId: string;        // Required — your OAuth client ID
    redirectUri: string;    // Required — callback URL
    scopes?: string[];      // Optional — default: []
    authUrl?: string;      // Optional — default: Genation Auth
    ffApiUrl?: string;      // Optional — for license/consumable API
    storage?: "localStorage" | "sessionStorage" | "memory"; // Default: "localStorage"
});

API Reference

client.signIn()

Starts OAuth login. Returns authorization URL to redirect to.

window.location.href = await client.signIn();

client.handleCallback(url)

Exchanges authorization code for tokens. Call on your callback page.

await client.handleCallback(window.location.href);

client.getSession()

Returns current session with auto-refresh.

const session = await client.getSession();

client.signOut()

Signs out and clears local tokens.

await client.signOut();

client.onAuthStateChange(callback)

Subscribes to authentication state changes.

const { subscription } = client.onAuthStateChange((event, session) => {
    switch (event) {
        case "INITIAL_SESSION": break;
        case "SIGNED_IN":      break;
        case "SIGNED_OUT":     break;
        case "TOKEN_REFRESHED": break;
    }
});

// Cleanup
subscription.unsubscribe();

client.getLicenses()

Fetches user's licenses.

const licenses = await client.getLicenses();

client.getConsumables()

Fetches user's consumables.

const consumables = await client.getConsumables();

client.getConsumablePlans()

Fetches available consumable plans.

const plans = await client.getConsumablePlans();

Session Object

interface Session {
    accessToken: string;
    refreshToken?: string;
    expiresIn: number;
    expiresAt: number;
    user: User | null;
}

Auth Events

| Event | Trigger | |-------|---------| | INITIAL_SESSION | First load | | SIGNED_IN | Successful login | | SIGNED_OUT | Sign out or expired session | | TOKEN_REFRESHED | Access token auto-refreshed |

Storage

Tokens are stored in localStorage by default. Choose a storage strategy:

| Storage | Use Case | |---------|----------| | localStorage | Persistent across browser sessions | | sessionStorage | Cleared when tab closes | | memory | No persistence (useful for tests) |

const client = createPublicClient({
    clientId: "your-client-id",
    redirectUri: "...",
    storage: "sessionStorage",
});

License

MIT