From 9746b9925f014b4e7237aeb4af21f0b99471fcdc Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Thu, 29 Apr 2021 15:40:12 +0200 Subject: [PATCH] some better parameterization of NK LinK --- rowers/nkstuff.py | 6 +++--- rowers/views/importviews.py | 3 ++- rowsandall_app/settings.py | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/rowers/nkstuff.py b/rowers/nkstuff.py index 445b36f2..5ad04b85 100644 --- a/rowers/nkstuff.py +++ b/rowers/nkstuff.py @@ -29,7 +29,7 @@ import gzip from rowsandall_app.settings import ( NK_CLIENT_ID, NK_REDIRECT_URI, NK_CLIENT_SECRET, - SITE_URL, NK_API_LOCATION, + SITE_URL, NK_API_LOCATION,NK_OAUTH_LOCATION, UPLOAD_SERVICE_URL, UPLOAD_SERVICE_SECRET, ) @@ -48,13 +48,13 @@ oauth_data = { 'client_id': NK_CLIENT_ID, 'client_secret': NK_CLIENT_SECRET, 'redirect_uri': NK_REDIRECT_URI, - 'autorization_uri': "https://oauth-stage.nkrowlink.com/oauth/authorize", + 'autorization_uri': NK_OAUTH_LOCATION+"/oauth/authorize", 'content_type': 'application/json', 'tokenname': 'nktoken', 'refreshtokenname': 'nkrefreshtoken', 'expirydatename': 'nktokenexpirydate', 'bearer_auth': True, - 'base_url': "https://oauth-stage.nkrowlink.com/oauth/token", + 'base_url': NK_OAUTH_LOCATION+"/oauth/token", 'scope':'read', } diff --git a/rowers/views/importviews.py b/rowers/views/importviews.py index d6a9e3c1..06ea12bf 100644 --- a/rowers/views/importviews.py +++ b/rowers/views/importviews.py @@ -11,6 +11,7 @@ def default(o): # pragma: no cover if isinstance(o, numpy.int64): return int(o) raise TypeError +from rowsandall_app.settings import NK_OAUTH_LOCATION # Send workout to TP @permission_required('workout.change_workout',fn=get_workout_by_opaqueid,raise_exception=True) @@ -407,7 +408,7 @@ def rower_nk_authorize(request): # pragma: no cover "redirect_uri": NK_REDIRECT_URI, } - url = "https://oauth-stage.nkrowlink.com/oauth/authorize?"+urllib.parse.urlencode(params) + url = NK_OAUTH_LOCATION+"/oauth/authorize?"+urllib.parse.urlencode(params) return HttpResponseRedirect(url) diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py index 93e7c6d7..989164d6 100644 --- a/rowsandall_app/settings.py +++ b/rowsandall_app/settings.py @@ -333,6 +333,7 @@ NK_CLIENT_ID = CFG["nk_client_id"] NK_CLIENT_SECRET = CFG["nk_client_secret"] NK_REDIRECT_URI = CFG["nk_redirect_uri"] NK_API_LOCATION = CFG["nk_api_location"] +NK_OAUTH_LOCATION = CFG["nk_oauth_location"] NK_VIEWER_LOCATION = CFG["nk_viewer_location"] # Full Site URL