Next.js Discord

Discord Forum

How do you configure the token endpoint for the battlenet provider?

Unanswered
German Longhaired Pointer posted this in #help-forum
Open in Discord
Avatar
German Longhaired PointerOP
I'm accessing the battlenet API as:

BattleNetProvider({
            clientId: process.env.BNET_CLIENT_ID as string,
            clientSecret: process.env.BNET_CLIENT_SECRET as string,
            issuer: "https://us.battle.net/oauth",
        }),

and would like to retrieve an access token. In [battlenet's docs](https://develop.battle.net/documentation/guides/using-oauth/client-credentials-flow), they state that you need to provide the client_id, client_secret and grant_type, but am unable to get a response from the API. I'm adding the [token option](https://next-auth.js.org/configuration/providers/oauth#token-option) as:

BattleNetProvider({
            clientId: process.env.BNET_CLIENT_ID as string,
            clientSecret: process.env.BNET_CLIENT_SECRET as string,
            issuer: "https://us.battle.net/oauth",
            token: {
                url: "https://oauth.battle.net/token",
                params: {
                    client_id:process.env.BNET_CLIENT_ID,
                    client_secret: process.env.BNET_CLIENT_SECRET,
                    grant_type: "client_credentials"
                }
            }
        }),


but it's not working and I'm not sure why. I hope to get an answer on why here.

0 Replies