heavstal-auth
v1.0.4
Published
The official NextAuth provider for Heavstal Tech.
Maintainers
Readme
Heavstal Auth Provider
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.
📦 Installation
npm install heavstal-auth
# or
yarn add heavstal-auth
# or
pnpm add heavstal-authNote: You must have
next-authinstalled 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_xxxxxxxxxxxx3. Configure NextAuth
Import HeavstalProvider and add it to your providers list. It works exactly like the built-in Google or GitHub providers.
In app/api/auth/[...nextauth]/route.ts (or auth.ts):
import NextAuth from "next-auth";
import HeavstalProvider from "heavstal-auth";
const handler = NextAuth({
providers: [
// The Heavstal Provider
HeavstalProvider({
clientId: process.env.HEAVSTAL_CLIENT_ID!,
clientSecret: process.env.HEAVSTAL_CLIENT_SECRET!,
}),
// Other providers...
],
// Optional: Enable debug to see OAuth flow details in console
debug: process.env.NODE_ENV === "development",
});
export { handler as GET, handler as POST };🧩 TypeScript Support
This package is written in TypeScript and includes type definitions out of the box. The user profile returned by Heavstal includes:
id(Heavstal User ID)nameemailimage(Profile Picture URL)
⚙️ How it works
Under the hood, this package 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
You don't need to worry about endpoints or OIDC discovery—it's all handled for you.
🔗 Links
Made with ❤️ by Heavstal Tech
