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

orator-authentication

v1.0.0

Published

Orator server-side cookie-based session authentication with pluggable authenticator and optional OAuth/OIDC support.

Readme

Orator Authentication

Server-side cookie-based session authentication with pluggable authenticator and optional OAuth/OIDC support

Orator Authentication is a Fable service provider that adds cookie-based session management to any Orator API server. Plug in your own credential verification function, or use the built-in allow-all authenticator during development. For federated identity, add OAuth 2.0 / OpenID Connect login via any OIDC provider, or use the dedicated MSAL provider for advanced Microsoft/Exchange scenarios.

Features

  • Cookie-Based Sessions - Server-side session store with HttpOnly cookies and configurable TTL
  • Pluggable Authenticator - Replace credential verification without touching routes
  • Zero-Config Defaults - Works out of the box for development with sensible defaults
  • OAuth 2.0 / OIDC - Optional federated login via OpenID Connect (Google, Okta, Azure AD, Auth0)
  • Microsoft MSAL - Dedicated provider for Exchange Online, Graph API, and Azure AD B2C
  • PKCE - All OAuth flows use Proof Key for Code Exchange for maximum security
  • Fable Integration - First-class service provider with logging, configuration, and UUID generation

Quick Start

const libFable = require('fable');
const libOrator = require('orator');
const libOratorServiceServerRestify = require('orator-serviceserver-restify');
const libOratorAuthentication = require('orator-authentication');

const _Fable = new libFable({
	Product: 'MyApp',
	ProductVersion: '1.0.0',
	APIServerPort: 8080
});

_Fable.serviceManager.addServiceType('OratorServiceServer', libOratorServiceServerRestify);
_Fable.serviceManager.addServiceType('Orator', libOrator);
_Fable.serviceManager.addServiceType('OratorAuthentication', libOratorAuthentication);

_Fable.serviceManager.instantiateServiceProvider('Orator');
_Fable.serviceManager.instantiateServiceProvider('OratorAuthentication');

_Fable.Orator.startService(
	() =>
	{
		_Fable.OratorAuthentication.connectRoutes();
		console.log('Server running on port 8080');
	});

Test it:

# Authenticate
curl http://localhost:8080/1.0/Authenticate/alice/password123

# Check session
curl -b "SessionID=<id>" http://localhost:8080/1.0/CheckSession

# Log out
curl -b "SessionID=<id>" http://localhost:8080/1.0/Deauthenticate

Installation

npm install orator-authentication

For OAuth support, install the provider library you need:

# Any OIDC provider (Google, Okta, Auth0, Azure AD)
npm install openid-client

# Microsoft-specific (Exchange, Graph API, Azure AD B2C)
npm install @azure/msal-node

Plugging In Real Authentication

_Fable.OratorAuthentication.setAuthenticator(
	(pUsername, pPassword, fCallback) =>
	{
		myDatabase.verifyCredentials(pUsername, pPassword,
			(pError, pUser) =>
			{
				if (pError || !pUser)
				{
					return fCallback(null, null); // null = auth failed
				}
				return fCallback(null, {
					LoginID: pUser.Username,
					IDUser: pUser.ID,
					Email: pUser.Email
				});
			});
	});

Adding OAuth Login

_Fable.serviceManager.instantiateServiceProvider('OratorAuthentication',
	{
		OAuthProviders:
		{
			'google':
			{
				Type: 'openid-connect',
				IssuerURL: 'https://accounts.google.com',
				ClientID: process.env.GOOGLE_CLIENT_ID,
				ClientSecret: process.env.GOOGLE_CLIENT_SECRET,
				CallbackURL: 'http://localhost:8080/1.0/OAuth/Callback/google'
			}
		}
	});

Then direct users to /1.0/OAuth/Begin/google to start the login flow.

Configuration

| Setting | Default | Description | |---------|---------|-------------| | RoutePrefix | '/1.0/' | URL prefix for all routes | | SessionTTL | 86400000 (24h) | Session time-to-live in milliseconds | | CookieName | 'SessionID' | Name of the session cookie | | CookieHttpOnly | true | HttpOnly flag on cookie | | CookieSecure | false | Secure flag on cookie (HTTPS only) | | DeniedPasswords | [] | Passwords to reject before authenticator runs | | OAuthPostLoginRedirectURL | '/' | Where to redirect after OAuth login |

Documentation

Full documentation is available in the docs folder, or served locally:

Related Packages

License

MIT

Contributing

Pull requests are welcome. For details on our code of conduct, contribution process, and testing requirements, see the Retold Contributing Guide.