Hi,
I have been trying to access the application usage using Python.
I have appId and app secret
The steps that I have been following:
1. Using app ID and secret to get an access token (using https://[root]/oauth2/token url)
2. Using access token to generate the token (using https://[root]/generateToken(POST only)). The parameters that are being passed are - token, serverURL, client and referer.
and passing the token in the usage url
The result I'm getting -
b'{"error":{"code":403,"messageCode":"GWM_0003","message":"You do not have permissions to access this resource or perform this operation.","details":[]}}'
What is your role in your org? And are you the owner of the application?
Can you share your code you're using? I recently did this in another post and didn't see any errors.
I'm the administrator in the organization and the application is shared with the organization.
Please find below the snippet I am using to generate token:
## create access token
url = "https://cssl.maps.arcgis.com/sharing/rest/oauth2/token"
params = {'grant_type': 'client_credentials',
'client_id': <client id>,
'client_secret': <client secret>,
'expiration': 1440}
response = requests.post(url, data=params)
access_token = response.json()['access_token']
## generate token using access token
token_url = "https://cssl.maps.arcgis.com/sharing/rest/generateToken"
params2 = {'request': 'getToken',
'token': access_token,
'client': 'referer',
'referer': 'https://cssl.maps.arcgis.com',
'serverURL': 'https://cssl.maps.arcgis.com',
'f': 'json'}
resp = requests.post(token_url, data=params2)
my_token = resp.json()['token']
Regards,
Vaibhav