Select to view content in your preferred language

AGO - Programmatically generate token with enterprise login credentials?

3236
0
08-06-2015 06:04 AM
MatthewLofgren
Occasional Contributor

Our IT dept recently implemented ADFS allowing us to migrate to enterprise logins. We have some python scripts to help manage our AGO organization where we need to generate a token like -

parameters = urllib.urlencode({'username' : username,
                                       'password' : password,
                                       'client' : 'referer',
                                       'referer': url,
                                       'expiration': 60,
                                       'f' : 'json'})
        response = urllib.urlopen(url + '/sharing/rest/generateToken?', parameters).read()
        token = json.loads(response)['token']

The REST API calls require a token to fulfill some request. How can we generate a token with enterprise logins?

example of script where we need to pass a token -

parameters = urllib.urlencode({'token': token, 'f': 'pjson'})
request = Url + '/sharing/rest/community/users/' + user + '?' + parameters
response = urllib.urlopen(request).read()
0 Kudos
0 Replies