Skip to content
Migrating from NextAuth.js v4? Read our migration guide.

Battle.net Provider

Resources

Setup

Callback URL

https://example.com/api/auth/callback/battlenet

Environment Variables

AUTH_BATTLENET_ID
AUTH_BATTLENET_SECRET
AUTH_BATTLENET_ISSUER

issuer must be one of these values, based on the available regions:

type BattleNetIssuer =
| "https://www.battlenet.com.cn/oauth"
| "https://us.battle.net/oauth"
| "https://eu.battle.net/oauth"
| "https://kr.battle.net/oauth"
| "https://tw.battle.net/oauth"

Configuration

/auth.ts
import NextAuth from "next-auth";
import BattleNet from "next-auth/providers/battlenet";
 
export const { handlers, auth, signIn, signOut } = NextAuth({
  providers: [BattleNet({
    clientId: AUTH_BATTLENET_CLIENT_ID
    clientSecret: AUTH_BATTLENET_CLIENT_SECRET
    issuer: AUTH_BATTLENET_ISSUER
  })]
});
Auth.js © Balázs Orbán and Team - 2024