now getting user info
This commit is contained in:
@@ -101,7 +101,7 @@ def get_token(code):
|
||||
return [thetoken,expires_in,user_id]
|
||||
|
||||
# Make authorization URL including random string
|
||||
def make_authorization_url(request):
|
||||
def make_authorization_url():
|
||||
# Generate a random string for the state parameter
|
||||
# Save it for use later to prevent xsrf attacks
|
||||
from uuid import uuid4
|
||||
@@ -114,6 +114,8 @@ def make_authorization_url(request):
|
||||
import urllib
|
||||
url = "https://flow.polar.com/oauth2/authorization" +urllib.urlencode(params)
|
||||
|
||||
print url
|
||||
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
def get_polar_workout_list(user):
|
||||
@@ -133,6 +135,12 @@ def get_polar_workout_list(user):
|
||||
userid = r.polaruserid
|
||||
)
|
||||
|
||||
# url = 'https://polaraccesslink.com/v3/users/{userid}/activity-transactions'.format(
|
||||
# userid = r.polaruserid
|
||||
# )
|
||||
|
||||
print url
|
||||
|
||||
response = requests.post(url, headers=headers)
|
||||
|
||||
return response
|
||||
|
||||
@@ -2399,10 +2399,11 @@ def rower_polar_authorize(request):
|
||||
"response_type": "code",
|
||||
"redirect_uri": POLAR_REDIRECT_URI,
|
||||
"state": state,
|
||||
# "scope":"accesslink.read_all"
|
||||
"scope":"accesslink.read_all"
|
||||
}
|
||||
url = "https://flow.polar.com/oauth2/authorization?" +urllib.urlencode(params)
|
||||
|
||||
print url
|
||||
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
|
||||
@@ -2644,11 +2645,7 @@ def rower_process_polarcallback(request):
|
||||
messages.error(request,message)
|
||||
return imports_view(request)
|
||||
|
||||
res = polarstuff.get_token(code)
|
||||
|
||||
access_token = res[0]
|
||||
expires_in = res[1]
|
||||
user_id = res[2]
|
||||
access_token, expires_in, user_id = polarstuff.get_token(code)
|
||||
|
||||
expirydatetime = timezone.now()+datetime.timedelta(seconds=expires_in)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user