"Try it"-site and CURL requests gives me different AccessTokens

I am having a problem retrieving my AccessToken.

I can test my requests using my ClientID and ClientSecret with API examples from API reference site.

Using those examples I get sample URL that includes my AccessToken as a part of URL. I can create my solution with this AccessToken and with those example URLs.

Example URL in my solution to get character information:

“…/wow/character/”&pRealm&“/”&pCharName&“?fields=items&locale=en_GB&access_token=”&pAccessToken

I have included a request for AccessToken in my solution but that gives totally different AccessToken than using above method. I am using request as adviced in API Guides, using oauth.

This is my Python script:

import requests

data = {
‘grant_type’: ‘client_credentials’
}

response = requests.post(‘…/oauth/token’, data=data, auth=(‘xxx’, ‘yyy’))

print(response.text)

This requests gives me totally different access token that testing site’s access token. Any advice?

Not sure if understand what you mean by different access token, but here some information:

The API website uses your credentials to create a token using the OAuth2 authorization_code flow, this means the access token is bound to your account and you can fetch a list of characters or other account related data.

Your code is creating an access_token using the client_credentials flow, with this token you can access most endpoints except the ones tied to account data.

https://develop.battle.net/documentation/guides/using-oauth

Thank you for clearing this up… I’ve never done API requests before and I was so confused.

I just want to request my account data. Is there a way to request that AccessTokens with my ClientID and ClientSecret?

For any account data you need the user to “sing in with Battle net”, that means using the OAuth2 authorization code flow described in the API docs.