How to get user details after login via oauth?

141 views Asked by At

Trying to understand how it works oauth
How to get authorized user details using Blizzard api?

import json
import requests

client_id = ""
client_secret = ""
region = "eu"
data = {
    'grant_type': 'client_credentials'
}
access_token_response = requests.post(f"https://{region}.battle.net/oauth/token", data=data, allow_redirects=False, auth=(client_id, client_secret))
access_token = json.loads(access_token_response.text)["access_token"]
api_call_headers = {
    'Authorization': 'Bearer ' + access_token
}
api_call_response = requests.get(f"https://{region}.battle.net/oauth/userinfo", headers=api_call_headers)
0

There are 0 answers