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-node-core

v0.1.10

Published

MonoCloud NodeJS Authentication Core SDK

Readme

Introduction

MonoCloud Auth Node SDK – secure authentication and session management for Node.js backends.

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

This package provides a high-level authentication client for Node.js applications, built on top of MonoCloud’s OpenID Connect (OIDC) implementation. It abstracts the complexity of OAuth/OIDC while remaining framework-agnostic.

The SDK handles:

  • Authorization Code Flow with PKCE
  • Secure session management using encrypted cookies
  • Automatic token rotation via refresh tokens
  • State and CSRF validation out of the box

This package builds on @monocloud/auth-core and adds Node.js–specific session and cookie handling.

📘 Documentation

Supported Platforms

  • Node.js >= 16.0.0

Requirements

  • A MonoCloud Tenant
  • A Client ID and Client Secret (configured as a Web Application)
  • A Random secret (32+ characters) for encrypting session cookies

📦 Installation

npm install @monocloud/auth-node-core

Initialization

Initialize the client with your tenant and application configuration.

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

const nodeClient = new MonoCloudCoreClient({
  tenantDomain: 'https://<your-tenant-domain>',
  clientId: '<your-client-id>',
  clientSecret: '<your-client-secret>',
  appUrl: '<application-server-url>',
  cookieSecret: '<cookie-secret>', // Used to encrypt the session cookie
});

⚠️ Security Note: Never commit secrets to source control. Always load them from environment variables.

Usage

The SDK is framework-agnostic. It operates on generic request/response adapters so it can be used with Express, Fastify, Hapi, or custom servers.

Sign In

Redirects the user to MonoCloud to start authentication.

import type { MonoCloudRequest, MonoCloudResponse } from '@monocloud/auth-node-core';

const request: MonoCloudRequest =   /* framework adapter */;
const response: MonoCloudResponse = /* framework adapter */;

// Default route: /api/auth/signin
await nodeClient.signIn(request, response);

Handle Callback

Handles the redirect from MonoCloud, validates state, exchanges the authorization code for tokens, and sets the encrypted session cookie.

import type { MonoCloudRequest, MonoCloudResponse } from '@monocloud/auth-node-core';

const request: MonoCloudRequest =   /* framework adapter */;
const response: MonoCloudResponse = /* framework adapter */;

// Default route: /api/auth/callback
await nodeClient.callback(request, response);

Get Session

Retrieve the current authenticated session from the request.

const session = await nodeClient.getSession(request, response);

console.log(session);

Sign Out

Clears the local session and redirects the user to MonoCloud to terminate the SSO session.

import type { MonoCloudRequest, MonoCloudResponse } from '@monocloud/auth-node-core';

const request: MonoCloudRequest =   /* framework adapter */;
const response: MonoCloudResponse = /* framework adapter */;

// Default route: /api/auth/signout
await nodeClient.signOut(request, response);

When should I use auth-node-core?

Use @monocloud/auth-node-core if you are building a Node.js backend and want a secure authentication solution without tying yourself to a specific framework.

This package is a good fit if you:

  • Are building an API or server-rendered application in Node.js
  • Want cookie-based sessions with encryption handled for you
  • Need built-in handling for OIDC redirects, state validation, and token exchange
  • Want to manage authentication in a custom servers
  • Prefer a framework-agnostic solution with sensible security defaults

auth-node-core builds on top of @monocloud/auth-core and adds Node-specific features such as encrypted session cookies and refresh token rotation.

Higher-level packages reuse the same underlying OIDC implementation but provide framework-specific ergonomics.

🤝 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.