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

@dashnex.com/oauth-client

v0.0.2

Published

DashNex Oauth Client

Readme

DashNex OAuth Client

A TypeScript library for handling OAuth 2.0 authentication with DashNex services. This library supports both traditional OAuth 2.0 with client secrets and PKCE (Proof Key for Code Exchange) flow for enhanced security.

Features

  • OAuth 2.0 Authorization Code Flow
  • PKCE (Proof Key for Code Exchange) support
  • Token refresh functionality
  • Cross-platform base64 encoding
  • TypeScript support with type definitions

Installation

npm install @dashnex.com/oauth-client

Usage

Basic Setup

import { DashNexOauthClient } from '@dashnex.com/oauth-client';

const client = new DashNexOauthClient({
  clientId: 'your-client-id',
  redirectUri: 'https://your-app.com/callback',
  // Optional: baseUrl if different from default
  baseUrl: 'https://dashnex.com'
});

With Client Secret (Traditional OAuth)

const client = new DashNexOauthClient({
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret',
  redirectUri: 'https://your-app.com/callback'
});

// Generate authorization URL, provide scope as optional parameter
const authUrl = client.getAuthorizationUrl();

// Redirect user to authUrl, receive the code from the URL

// After receiving the code in your callback
const token = await client.exchangeCodeForToken(code);

// store the token for further usage

With PKCE (Recommended for Public Clients)

const client = new DashNexOauthClient({
  clientId: 'your-client-id',
  redirectUri: 'https://your-app.com/callback'
});

// Generate authorization URL (PKCE will be automatically used)
const authUrl = client.getAuthorizationUrl(); // optionally add the scope as parameter

// Store the code verifier securely (e.g., in session storage)
const codeVerifier = // ... get from storage

// Exchange the code for tokens
const token = await client.exchangeCodeForToken(code, codeVerifier);
// store the token for further usage

Refreshing Tokens

// Refresh an expired access token
const newToken = await client.refreshAccessToken(refreshToken);

// store the newToken for further usage

Types

Configuration

type DashNexAuthClientConfig = {
  clientId: string;
  clientSecret?: string;  // Optional
  redirectUri: string;
  baseUrl?: string;      // Optional, defaults to 'https://dashnex.com'
};

Auth Token

type AuthToken = {
  access_token: string;
  refresh_token: string;
  expires_in: number;
  scope: string;
  token_type: string;
};

Security Considerations

  1. Always use HTTPS in production
  2. Store tokens securely
  3. Use PKCE flow for public clients (browser-based applications)
  4. Keep client secrets secure and never expose them in client-side code
  5. Validate state parameters to prevent CSRF attacks

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.