Garmin auth working
This commit is contained in:
@@ -56,9 +56,9 @@ def garmin_authorize():
|
||||
resource_owner_secret = fetch_response.get('oauth_token_secret')
|
||||
|
||||
authorization_url = garmin.authorization_url(base_uri)
|
||||
return authorization_url
|
||||
return authorization_url,resource_owner_key,resource_owner_secret
|
||||
|
||||
def garmin_processcallback(redirect_respones):
|
||||
def garmin_processcallback(redirect_response,resource_owner_key,resource_owner_secret):
|
||||
garmin = OAuth1Session(oauth_data['client_id'],
|
||||
client_secret=oauth_data['client_secret'],
|
||||
)
|
||||
|
||||
@@ -34,6 +34,8 @@ The auto import and export settings only work on <a href="/rowers/paidplans/">a
|
||||
alt="connect with Polar" width="130"></a></p>
|
||||
<p><a href="/rowers/me/tpauthorize/"><img src="/static/img/TP_logo_horz_2_color.png"
|
||||
alt="connect with Polar" width="130"></a></p>
|
||||
<p><a href="/rowers/me/garminauthorize"><img src="/static/img/garmin_badge_130.png"
|
||||
alt="connect with Garmin" with="130"></a></p>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -404,7 +404,9 @@ def rower_c2_authorize(request):
|
||||
# Garmin authorization
|
||||
@login_required()
|
||||
def rower_garmin_authorize(request):
|
||||
authorization_url = garmin_stuff.garmin_authorize()
|
||||
authorization_url,token,secret = garmin_stuff.garmin_authorize()
|
||||
request.session['garmin_owner_key'] = token
|
||||
request.session['garmin_owner_secret'] = secret
|
||||
return HttpResponseRedirect(authorization_url)
|
||||
|
||||
# Strava Authorization
|
||||
@@ -716,7 +718,10 @@ def rower_process_polarcallback(request):
|
||||
def rower_process_garmincallback(request):
|
||||
r = getrower(request.user)
|
||||
absoluteurl = request.build_absolute_uri()
|
||||
garmintoken,garminrefreshtoken = garmin_stuff.garmin_processcallback(absoluteurl)
|
||||
|
||||
key = request.session['garmin_owner_key']
|
||||
secret = request.session['garmin_owner_secret']
|
||||
garmintoken,garminrefreshtoken = garmin_stuff.garmin_processcallback(absoluteurl,key,secret)
|
||||
r.garmintoken = garmintoken
|
||||
r.garminrefreshtoken = garminrefreshtoken
|
||||
r.save()
|
||||
|
||||
BIN
static/img/Garmin_Connect_app_1024x1024-02.png
Normal file
BIN
static/img/Garmin_Connect_app_1024x1024-02.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 262 KiB |
BIN
static/img/Garmin_Connect_app_130x130.png
Normal file
BIN
static/img/Garmin_Connect_app_130x130.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
BIN
static/img/Garmin_connect_badge_print_RESOURCE_FILE-01.png
Normal file
BIN
static/img/Garmin_connect_badge_print_RESOURCE_FILE-01.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
BIN
static/img/garmin_badge_130.png
Normal file
BIN
static/img/garmin_badge_130.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.5 KiB |
BIN
static/img/garmin_badge_260.png
Normal file
BIN
static/img/garmin_badge_260.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Reference in New Issue
Block a user