Hi,
I am trying to use oauth2 with python in order to get a token that will allow me to query content in my organization with the arcgis library. Everything works correctly, except the fact that when I sign in to ArcGIS Online with the oauth2 token, I only have access to the public items.
I am administrator in my organization and I have created my oauth2 application in developers.arcgis.com
In python I am using the following code to get a token using the clientId and clientSecret
import request
import arcgis
def get_client_oauth2_token(portal_url, client_id, client_secret):
url = "{}/sharing/rest/oauth2/token".format(portal_url)
params = {
'client_id': client_id,
'grant_type': "client_credentials",
'client_secret': client_secret
}
r = requests.post(url, params=params, verify=True)
return r.json()
token = get_client_oauth2_token("https://www.arcgis.com", "my_client_id", "my_client_secret")["access_token"]
gis = arcgis.gis.GIS("https://www.arcgis.com", token=token, referer="https")
items = gis.content.search("", item_type="Map Service", max_items=100)
for item in items:
print("{} - {}".format(item.id, item.access))
Only public items are returned. I dont receive any error.
What is wrong with my oauth2 authentification here?
Thank you for your help!