Loading...

Heavstal Auth Provider

Heavstal Logo

![NPM Version](https://img.shields.io/npm/v/heavstal-auth?style=flat-square&color=blue) ![License](https://img.shields.io/npm/l/heavstal-auth?style=flat-square) ![Downloads](https://img.shields.io/npm/dm/heavstal-auth?style=flat-square)

The official NextAuth.js (Auth.js) provider for the Heavstal Tech Identity Platform.

This package enables seamless integration of Heavstal OAuth 2.0 & OpenID Connect (OIDC) authentication into Next.js and Node.js applications. It pre-configures authorization endpoints, token exchanges, and user profile mapping, ensuring security best practices.


Features

  • Zero-Configuration: Pre-configured endpoints for Heavstal Identity services.
  • OIDC Compliant: Fully supports OpenID Connect discovery and ID Token verification.
  • TypeScript Support: Written in TypeScript with included type definitions.
  • Secure Defaults: Enforces PKCE (Proof Key for Code Exchange) and state verification by default.

Installation

Ensure you have next-auth installed in your project.

bash

Configuration

1. Obtain Credentials

Register your application in the Heavstal Developer Console to obtain your Client ID and Client Secret.

2. Environment Variables

Add the following to your .env or .env.local file:

bash

3. Usage with NextAuth.js

Import HeavstalProvider and add it to your NextAuth configuration.

File: app/api/auth/[...nextauth]/route.ts (App Router) or pages/api/auth/[...nextauth].ts (Pages Router).

typescript

Integration with Non-Next.js Applications

Heavstal Tech is a standard OpenID Connect (OIDC) provider. If you are using a different framework (Express, Python, Go, etc.) or a library that supports OIDC Discovery, you do not need this specific SDK.

You can configure your client using the Issuer URL.

OIDC Discovery Configuration

Parameter Value
Issuer URL https://accounts-heavstal.vercel.app
Discovery Document https://accounts-heavstal.vercel.app/.well-known/openid-configuration
JWKS Endpoint https://accounts-heavstal.vercel.app/.well-known/jwks.json

Example: Generic Node.js OIDC Client

javascript

User Profile Data

On successful authentication, the provider returns the following normalized user profile structure:

typescript

Resources


License

This project is licensed under the MIT License.

Copyright © 2025 - 2026 Heavstal Tech™. All rights reserved