I’m building an API that uses the “https://us.battle.net/oauth” issuer, but I would like some buttons that depending on which you click, they’ll give you an access token
according to the selected region (i.e. “US”, “EU”, “CN”, etc.).
I’m using NextJS with NextAuth, how would I go about this in here?
I added the [...nextauth].ts
file just in case it is needed.
export const authConfig = ():NextAuthOptions => {
return ({
providers: [
BattleNetProvider({
clientId: process.env.BNET_CLIENT_ID as string,
clientSecret: process.env.BNET_CLIENT_SECRET as string,
issuer: "https://us.battle.net/oauth",
authorization: {
params:{
client_id: process.env.BNET_CLIENT_ID ,
scope:"openid wow.profile sc2.profile d3.profile",
redirect_uri: process.env.BNET_REDIRECT_URL,
response_type:"code"}
}
}),
],
callbacks: {
async jwt({ token, account }) {
// Persist the OAuth access_token to the token right after signin
if (account) {
token.accessToken = account.access_token
}
return token
},
async session({ session, token, user } ) {
// Send properties to the client, like an access_token from a provider.
session.accessToken = token.accessToken as string
return session
}
},
})
}