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

auth-a-lib

v1.0.1

Published

Package to Integrate with Auth-A dev portal

Readme

Auth-A Library

JavaScript library for integrating Auth-A authentication into your web applications. Provides a simple, secure OAuth 2.0 with PKCE flow implementation.

Installation

npm install auth-a-lib

Quick Start

import { ClientApp } from 'auth-a-lib';

// Initialize the client with your Auth-A client ID
const authClient = new ClientApp('your-client-id');

// Initiate login (async method)
await authClient.login('https://your-app.com/callback');

Usage

1. Initialize the Client

Create a new instance of ClientApp with your client ID from the Auth-A Developer Portal:

const authClient = new ClientApp('your-client-id-here');

2. Initiate Login Flow

Call the login() method with your callback URL. The user will be redirected to Auth-A for authentication:

// The login method is async
await authClient.login('https://your-app.com/callback');

Note: The login() method will:

  • Generate a secure PKCE code verifier and challenge
  • Store the verifier in sessionStorage for later token exchange
  • Redirect the user to Auth-A login page

3. Handle the Callback

After successful authentication, Auth-A will redirect back to your specified URL with an authorization code. You'll need to exchange this code for tokens using your backend.

API Reference

ClientApp

Constructor

new ClientApp(clientId: string)
  • clientId (required): Your Auth-A application client ID

Methods

login(redirectURL: string): Promise<void>

Initiates the OAuth 2.0 authentication flow with PKCE.

  • redirectURL (required): The URL to redirect to after authentication
  • Returns: Promise that resolves when redirect is initiated
  • Throws: Error if clientId is invalid or redirectURL is not provided

Example:

try {
  await authClient.login('https://myapp.com/auth/callback');
} catch (error) {
  console.error('Login failed:', error.message);
}

Browser Compatibility

This library uses the Web Crypto API and requires:

  • Chrome 37+
  • Firefox 34+
  • Safari 11+
  • Edge 79+

Security

This library implements OAuth 2.0 with PKCE (Proof Key for Code Exchange) for enhanced security:

  • Cryptographically secure random code verifier generation
  • SHA-256 hashing for code challenge
  • Code verifier stored securely in sessionStorage

Development

Local Testing with yalc

To test this library locally in another project:

  1. Build the library:
npm run build
  1. Publish to yalc:
yalc publish
  1. In your test project:
yalc add auth-a-lib
npm install
  1. After making changes to the library:
npm run build
yalc push

Build Commands

  • npm run build - Build production bundles
  • npm run dev - Build in watch mode for development

License

ISC

Author

Andrew William Staines