nkauthorize redirect works, callback not
This commit is contained in:
@@ -997,6 +997,11 @@ class Rower(models.Model):
|
||||
|
||||
rp3_auto_import = models.BooleanField(default=False)
|
||||
|
||||
nktoken = models.TextField(default='',max_length=1000,blank=True,null=True)
|
||||
nktokenexpirydate = models.DateTimeField(blank=True,null=True)
|
||||
nkrefreshtoken = models.TextField(default='',max_length=1000,
|
||||
blank=True,null=True)
|
||||
|
||||
trainingpeaks_auto_export = models.BooleanField(default=False)
|
||||
|
||||
polartoken = models.CharField(default='',max_length=1000,blank=True,null=True)
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
choice or to renew the authorization.</p>
|
||||
<p><a href="/rowers/me/stravaauthorize/"><img src="/static/img/ConnectWithStrava.png" alt="connect with strava" width="120"></a></p>
|
||||
<p><a href="/rowers/me/c2authorize/"><img src="/static/img/blueC2logo.png" alt="connect with Concept2" width="120"></a></p>
|
||||
<p><a href="/rowers/me/nkauthorize/"><img src="/static/img/NKLiNK.jpg" alt="connect with NK LiNK" width="120"></a></p>
|
||||
<p><a href="/rowers/me/sporttracksauthorize/"><img src="/static/img/sporttracks-button.png" alt="connect with SportTracks" width="120"></a></p>
|
||||
<p><a href="/rowers/me/runkeeperauthorize/"><img src="/static/img/rk-logo.png" alt="connect with RunKeeper" width="120"></a></p>
|
||||
<p><a href="/rowers/me/underarmourauthorize/"><img src="/static/img/UAbtn.png" alt="connect with Under Armour" width="120"></a></p>
|
||||
|
||||
@@ -671,6 +671,7 @@ urlpatterns = [
|
||||
re_path(r'^me/preferences/user/(?P<userid>\d+)/$',views.rower_prefs_view,name='rower_prefs_view'),
|
||||
re_path(r'^me/edit/(.+.*)/$',views.rower_edit_view,name='rower_edit_view'),
|
||||
re_path(r'^me/c2authorize/$',views.rower_c2_authorize,name='rower_c2_authorize'),
|
||||
re_path(r'^me/nkauthorize/$',views.rower_nk_authorize,name='rower_nk_authorize'),
|
||||
re_path(r'^me/polarauthorize/$',views.rower_polar_authorize,name='rower_polar_authorize'),
|
||||
re_path(r'^me/revokeapp/(?P<id>\d+)/$',views.rower_revokeapp_view,name='rower_revokeapp_view'),
|
||||
re_path(r'^me/stravaauthorize/$',views.rower_strava_authorize,name='rower_strava_authorize'),
|
||||
|
||||
@@ -392,6 +392,25 @@ def workout_sporttracks_upload_view(request,id=0):
|
||||
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
|
||||
# NK LiNK authorization
|
||||
@login_required()
|
||||
def rower_nk_authorize(request):
|
||||
state = str(uuid4())
|
||||
scope = "read"
|
||||
params = {
|
||||
"grant_type": "authorization_code",
|
||||
"response_type": "code",
|
||||
"client_id": NK_ClIENT_ID,
|
||||
"scope": scope,
|
||||
"state": state,
|
||||
"redirect_uri": NK_REDIRECT_URI,
|
||||
}
|
||||
|
||||
url = "https://oauth-stage.nkrowlink.com/oauth/authorize?"+urllib.parse.urlencode(params)
|
||||
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
# Concept2 authorization
|
||||
@login_required()
|
||||
def rower_c2_authorize(request):
|
||||
|
||||
@@ -185,7 +185,8 @@ from rowsandall_app.settings import (
|
||||
RP3_CLIENT_ID,RP3_REDIRECT_URI,RP3_CLIENT_KEY,RP3_CLIENT_SECRET,
|
||||
BRAINTREE_MERCHANT_ID,BRAINTREE_PUBLIC_KEY,BRAINTREE_PRIVATE_KEY,
|
||||
PAYMENT_PROCESSING_ON,
|
||||
RECAPTCHA_SITE_KEY, RECAPTCHA_SITE_SECRET
|
||||
RECAPTCHA_SITE_KEY, RECAPTCHA_SITE_SECRET,
|
||||
NK_REDIRECT_URI, NK_ClIENT_ID, NK_CLIENT_SECRET
|
||||
)
|
||||
|
||||
#from rowers.tasks_standalone import addcomment2
|
||||
|
||||
BIN
static/img/NKLiNK.jpg
Normal file
BIN
static/img/NKLiNK.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
static/img/NK_white.png
Normal file
BIN
static/img/NK_white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Reference in New Issue
Block a user