diff --git a/rowers/ownapistuff.py b/rowers/ownapistuff.py index 4a1754bf..3ec7088e 100644 --- a/rowers/ownapistuff.py +++ b/rowers/ownapistuff.py @@ -85,9 +85,9 @@ def get_token(code): client_auth = requests.auth.HTTPBasicAuth(TEST_CLIENT_ID, TEST_CLIENT_SECRET) post_data = {"grant_type": "authorization_code", "code": code, - "redirect_uri": TEST_REDIRECT_URI, - "client_secret": TEST_CLIENT_SECRET, - "client_id":TEST_CLIENT_ID, + "redirect_uri": "http://localhost:8000/rowers/test_callback", + "client_secret": "aapnootmies", + "client_id":1, } headers = {'Accept': 'application/json', 'Content-Type': 'application/json'} @@ -99,12 +99,12 @@ def get_token(code): data=json.dumps(post_data), headers=headers) - print response.text token_json = response.json() thetoken = token_json['access_token'] expires_in = token_json['expires_in'] refresh_token = token_json['refresh_token'] + return [thetoken,expires_in,refresh_token] def make_authorization_url(request): diff --git a/rowers/views.py b/rowers/views.py index 56fb1961..f9ba1e97 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -105,7 +105,7 @@ from interactiveplots import * schema_view = get_swagger_view(title='Rowsandall API (Unstable)') - + def error500_view(request): response = render_to_response('500.html', {}, @@ -4830,7 +4830,7 @@ def strokedatajson(request,id): if request.method == 'GET': - columns = ['spm','timesecs','hr','pseconds','power','distance'] + columns = ['spm','time','hr','pace','power','distance'] datadf = dataprep.getsmallrowdata_db(columns,ids=[id]) return JSONResponse(datadf) diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py index fed8a01c..a0b4513d 100644 --- a/rowsandall_app/settings.py +++ b/rowsandall_app/settings.py @@ -200,6 +200,7 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media') # user authentication LOGIN_REDIRECT_URL = '/rowers/list-workouts/' LOGIN_URL = '/login/' +LOGOUT_URL = '/logout/' # Concept 2 C2_CLIENT_ID = "bgTBbmjSyn8wbJb0JEdlYjDUfSZFAPQSzJV8YDwH" @@ -260,7 +261,8 @@ GMAPIKEY = "AIzaSyAgu1w9QSthaGPMLp8y9JedPoMc9sfEgJ8" OAUTH2_PROVIDER = { # this is the list of available scopes - 'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'} + 'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'}, + 'OAUTH2_BACKEND_CLASS': 'oauth2_provider.oauth2_backends.JSONOAuthLibCore' } @@ -280,6 +282,15 @@ REST_FRAMEWORK = { 'PAGE_SIZE': 20, } +SWAGGER_SETTINGS = { + 'SECURITY_DEFINITION': { + 'basic': { + 'type':'basic' + } + }, + 'SHOW_REQUEST_HEADERS': True, + } + # Analytics CLICKY_SITE_ID = '101011008'