AnsweredAssumed Answered

AGO - Programmatically generate token with enterprise login credentials?

Question asked by matt2222 on Aug 6, 2015

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()