I'm interfacing with the CF API at Bluemix. I authenticate to the OAuth endpoint with the following:
oauth_endpoint = 'https://login.ng.bluemix.net/UAALoginServerWAR/oauth/token'
http_headers = {
'Authorization': 'Basic Y2Y6'
}
http_payload = {
'grant_type': 'password',
'username': user,
'password': pw
}
response = requests.post(oauth_endpoint, data=http_payload, headers=http_headers)
results = response.json()
authorization = results['token_type'] + ' ' + results['access_token']
authorized_headers = {
'Authorization': authorization
}
And then to refresh the token:
http_refresh_payload = {
'grant_type': 'refresh_token',
'refresh_token': results['refresh_token']
}
response = requests.post(oauth_endpoint, data=http_refresh_payload, headers=http_headers)
results = response.json()
authorization = results['token_type'] + ' ' + results['access_token']
authorized_headers = {
'Authorization': authorization
}
The expiration on these tokens is longer than I want. How do I specify a shorter expiration?