DEV Community

HEAVSTAL TECH™
HEAVSTAL TECH™

Posted on

Heavstal Auth — NextAuth Provider for Heavstal Tech

Heavstal Auth Provider

Heavstal Logo

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

Easily integrate “Sign in with Heavstal” into your Next.js applications without manually configuring authorization URLs, token endpoints, or user profile mappings.

📦 npm: https://www.npmjs.com/package/heavstal-auth

📂 GitHub: https://github.com/Promise818/heavstal-auth

NPM Version
License


📦 Installation

npm install heavstal-auth
# or
yarn add heavstal-auth
# or
pnpm add heavstal-auth
Enter fullscreen mode Exit fullscreen mode

Note: You must have next-auth installed in your project.


🚀 Usage

1. Get your credentials

Go to the Heavstal Developer Console and create a new application to get your Client ID and Client Secret.

2. Add environment variables

Add these to your .env or .env.local file:

HEAVSTAL_CLIENT_ID=ht_id_xxxxxxxxxxxx
HEAVSTAL_CLIENT_SECRET=ht_secret_xxxxxxxxxxxx
Enter fullscreen mode Exit fullscreen mode

3. Configure NextAuth

Import HeavstalProvider and add it to your providers list. It works exactly like the built-in Google or GitHub providers.

app/api/auth/[...nextauth]/route.ts (or auth.ts):

import NextAuth from "next-auth";
import HeavstalProvider from "heavstal-auth";

const handler = NextAuth({
  providers: [
    HeavstalProvider({
      clientId: process.env.HEAVSTAL_CLIENT_ID!,
      clientSecret: process.env.HEAVSTAL_CLIENT_SECRET!,
    }),
  ],
  debug: process.env.NODE_ENV === "development",
});

export { handler as GET, handler as POST };
Enter fullscreen mode Exit fullscreen mode

🧩 TypeScript support

This package is written in TypeScript and includes type definitions out of the box.

The Heavstal user profile includes:

  • id
  • name
  • email
  • image

⚙️ How it works

Under the hood, this provider pre-configures:

  • Authorization URL: https://accounts-heavstal.vercel.app/oauth/authorize
  • Token URL: https://accounts-heavstal.vercel.app/api/oauth/token
  • User Info URL: https://accounts-heavstal.vercel.app/api/oauth/userinfo
  • Token Style: client_secret_post

No manual endpoint setup. No OIDC discovery hassle.


🔗 Links


Made with ❤️ by Heavstal Tech

Top comments (0)