Skip to content

Commit

Permalink
fix(providers): fix BattleNet
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Feb 22, 2022
1 parent 4234742 commit 163149b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
13 changes: 12 additions & 1 deletion docs/docs/providers/battlenet.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,19 @@ providers: [
BattleNetProvider({
clientId: process.env.BATTLENET_CLIENT_ID,
clientSecret: process.env.BATTLENET_CLIENT_SECRET,
region: process.env.BATTLENET_REGION
issuer: process.env.BATTLENET_ISSUER
})
]
...
```

`issuer` must be one of these values, based on the [available regions](https://develop.battle.net/documentation/guides/regionality-and-apis):

```ts
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"
```
13 changes: 6 additions & 7 deletions packages/next-auth/src/providers/battlenet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ export interface BattleNetProfile {
battle_tag: string
}

/** See the [available regions](https://develop.battle.net/documentation/guides/regionality-and-apis) */
export type BattleNetIssuer =
| "https://www.battlenet.com.cn/oauth"
| `https://${"us" | "eu" | "kr" | "tw"}.battle.net/oauth`

export default function BattleNet<
P extends Record<string, any> = BattleNetProfile
>(
options: OAuthUserConfig<P> & {
issuer:
| "https://www.battlenet.com.cn/oauth"
| `https://${"US" | "EU" | "KR" | "TW"}.battle.net/oauth`
}
): OAuthConfig<P> {
>(options: OAuthUserConfig<P> & { issuer: BattleNetIssuer }): OAuthConfig<P> {
return {
id: "battlenet",
name: "Battle.net",
Expand Down

1 comment on commit 163149b

@vercel
Copy link

@vercel vercel bot commented on 163149b Feb 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.