Private
Public Access
1
0

token refresh works

This commit is contained in:
Sander Roosendaal
2017-04-16 16:06:58 +02:00
parent 2712b5d502
commit f9f9732e90
3 changed files with 33 additions and 5 deletions

View File

@@ -88,7 +88,7 @@ def custom_exception_handler(exc,message):
return res
# Refresh ST token using refresh token
def do_refresh_token(refreshtoken):
def do_refresh_token(refreshtoken,access_token):
client_auth = requests.auth.HTTPBasicAuth(UNDERARMOUR_CLIENT_KEY, UNDERARMOUR_CLIENT_SECRET)
post_data = {"grant_type": "refresh_token",
"client_secret": UNDERARMOUR_CLIENT_SECRET,
@@ -98,12 +98,13 @@ def do_refresh_token(refreshtoken):
headers = {'user-agent': 'sanderroosendaal',
"Api-Key":UNDERARMOUR_CLIENT_KEY,
'Accept': 'application/json',
'Content-Type': 'application/json'}
'Content-Type': 'application/x-www-form-urlencoded',
'authorization': 'Bearer %s' % access_token}
url = "https://api.ua.com/v7.1/oauth2/access_token"
url = "https://api.ua.com/v7.1/oauth2/access_token/"
response = requests.post(url,
data=json.dumps(post_data),
data=post_data,
headers=headers)
token_json = response.json()