Heavstal Auth — Heavstal Tech를 위한 NextAuth Provider
Source: Dev.to
Overview
Heavstal Tech용 공식 NextAuth.js (Auth.js) 프로바이더입니다.
인증 URL, 토큰 엔드포인트, 사용자 프로필 매핑을 직접 설정하지 않고도 Next.js 애플리케이션에 “Sign in with Heavstal”을 손쉽게 통합할 수 있습니다.
- 📦 npm:
- 📂 GitHub:
Installation
npm install heavstal-auth
# or
yarn add heavstal-auth
# or
pnpm add heavstal-auth
Note:
next-auth가 프로젝트에 설치되어 있어야 합니다.
Configuration
- Heavstal Developer Console에 접속하여 새 애플리케이션을 생성하고 Client ID와 Client Secret을 발급받습니다.
- 이를 환경 파일(
.env또는.env.local)에 추가합니다:
HEAVSTAL_CLIENT_ID=ht_id_xxxxxxxxxxxx
HEAVSTAL_CLIENT_SECRET=ht_secret_xxxxxxxxxxxx
Usage
NextAuth 설정에 프로바이더를 추가합니다.
// 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 };
이 패키지는 TypeScript로 작성되었으며, 타입 정의가 기본 제공됩니다.
Provider Details
Heavstal 사용자 프로필에는 다음 필드가 포함됩니다:
idnameemailimage
Endpoints (pre‑configured)
- 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
엔드포인트를 직접 설정하거나 OIDC 디스커버리를 수행할 필요가 없습니다.
Resources
- Heavstal Developer Console:
- OAuth Documentation:
- Heavstal Tech Platform:
Made with ❤️ by Heavstal Tech