Private
Public Access
1
0

fixed polar auth

This commit is contained in:
Sander Roosendaal
2019-03-18 21:46:20 +01:00
parent f1630a64df
commit 9482682d4b
3 changed files with 4 additions and 4 deletions

View File

@@ -75,14 +75,16 @@ def get_token(code):
try:
headers = { 'Authorization': 'Basic %s' % base64.b64encode(auth_string) }
print(headers,'aa')
except TypeError:
headers = { 'Authorization': 'Basic %s' % base64.b64encode(bytes(auth_string,'utf-8')) }
headers = { 'Authorization': 'Basic %s' % base64.b64encode(
bytes(auth_string,'utf-8')).decode('utf-8') }
response = requests.post("https://polarremote.com/v2/oauth2/token",
data=post_data,
headers=headers)
try:
token_json = response.json()
thetoken = token_json['access_token']

Binary file not shown.

View File

@@ -697,8 +697,6 @@ def rower_process_polarcallback(request):
return HttpResponseRedirect(url)
access_token, expires_in, user_id = polarstuff.get_token(code)
expirydatetime = timezone.now()+datetime.timedelta(seconds=expires_in)