I dont get what is wrong here

i have this code:

def getBattleTag(BattleNetToken, region):
    url = f"https://{region}.battle.net/oauth/userinfo?access_token={BattleNetToken}"
    response = requests.get(url)
    return response.json() if response.status_code == 200 else print(response.status_code)

when i do the get battle tag i get an 403 response code and i dont get why
the battleNetToken is ok i have a function who checks it and it is coming out ok but o am still getting 403 code and i dont know why

Did you get that token using Client Credential Flow or Authorization Code Flow?

They ended up getting it working with help from people on the Discord server.

The TLDR is that they were passing client_credentials instead of authorization_code when requesting the access token during the OAuth callback.

{"grant_type": 'authorization_code', "code": f"{code}", "redirect_uri": f"{Globals.redirect_URL}", "scope": "wow.profile"}

Thread:

https://discordapp.com/channels/255765915155693568/334084900892311552/719804172232556614