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

@monocloud/auth-core

v0.1.2

Published

MonoCloud Authentication JavaScript Core SDK

Readme

MonoCloud Logo

Introduction

MonoCloud OIDC Client for JavaScript — a standards-compliant OpenID Connect client for secure authentication flows.

MonoCloud is a modern, developer-friendly Identity & Access Management platform.

This package provides a framework-agnostic OpenID Connect (OIDC) client for interacting with MonoCloud. It supports industry-standard authentication flows including Authorization Code Flow, PKCE, Pushed Authorization Requests (PAR), and token lifecycle management.

This package focuses on core OIDC primitives. Framework-specific integrations (such as Next.js) are provided by higher-level packages built on top of auth-core.

📘 Documentation

Supported Platforms

  • Node.js >= 16.0.0 (Requires fetch and Web Crypto API)
  • Modern Browsers

Requirements

  • A MonoCloud Tenant
  • A Client configured as a Web Application or SPA

📦 Installation

npm install @monocloud/auth-core

Initialization

import { MonoCloudOidcClient } from '@monocloud/auth-core';

const oidcClient = new MonoCloudOidcClient(
  'https://<your-tenant-domain>',
  '<your-client-id>',
  {
    // Optional: clientSecret for confidential clients
    clientSecret: '<your-client-secret>',
  }
);

Usage

Generate an Authorization URL

Initiate sign-in by generating an authorization URL.

import { generateNonce, generateState } from '@monocloud/auth-core/utils';

const authorizeUrl = await oidcClient.authorizationUrl({
  redirectUri: '<registered callback url>',
  scopes: 'openid profile email',
  nonce: generateNonce(),
  state: generateState(),
});

// Redirect the user to authorizeUrl

Note: state and nonce should always be generated per request and validated on callback to prevent CSRF and token replay attacks.

Handle Callback

After authentication, exchange the authorization code for tokens.

const session = await oidcClient.authenticate(
  '<code>',
  '<registered callback url>',
  'openid profile email'
);

console.log(session.user);    // User profile claims
console.log(session.idToken); // Raw ID Token

Refresh a Session

Rotate tokens using the refresh token flow.

const refreshedSession = await oidcClient.refreshSession(session);

console.log(refreshedSession);

When should I use auth-core?

Use @monocloud/auth-core if you need a low-level, framework-agnostic OpenID Connect client and want full control over the authentication flow.

This package is a good fit if you:

  • Are building a custom authentication integration
  • Need fine-grained control over redirects, state, nonce, and PKCE
  • Are targeting non-framework environments (custom runtimes)
  • Are building your own framework adapter or SDK
  • Want a pure OIDC client without opinions about routing, cookies, or sessions

Higher-level packages are built on top of auth-core and provide framework-specific ergonomics while reusing the same underlying OIDC implementation.

🤝 Contributing & Support

Issues & Feedback

  • Use GitHub Issues for bug reports and feature requests.
  • For tenant or account-specific help, contact MonoCloud Support through your dashboard.

Security

Do not report security issues publicly. Please follow the contact instructions at: https://www.monocloud.com/contact

📄 License

Licensed under the MIT License. See the included LICENSE file.