How to access the application usage using appId and secret (programmatically)?

10-19-2021 06:37 AM
by Anonymous User
Not applicable

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":[]}}' 

0 Kudos
2 Replies
MVP Esteemed Contributor

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.

- Josh Carlson
Kendall County GIS
0 Kudos
by Anonymous User
Not applicable

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 = ""
params = {'grant_type': 'client_credentials',
'client_id': <client id>,
'client_secret': <client secret>,
'expiration': 1440}

response =, data=params)
access_token = response.json()['access_token']

## generate token using access token

token_url = ""
params2 = {'request': 'getToken',
'token': access_token,
'client': 'referer',
'referer': '',
'serverURL': '',
'f': 'json'}

resp =, data=params2)
my_token = resp.json()['token']


0 Kudos