diff --git a/rowers/imports.py b/rowers/imports.py index 44453c72..c1e150cc 100644 --- a/rowers/imports.py +++ b/rowers/imports.py @@ -122,6 +122,13 @@ def imports_do_refresh_token(refreshtoken,oauth_data,access_token=''): 'Accept': 'application/json', 'Content-Type': oauth_data['content_type']} + # for Strava + if 'grant_type' in oauth_data: + if oauth_data['grant_type']: + post_data['grant_type'] = oauth_data['grant_type'] + else: + grant_type = post_data.pop('grant_type',None) + if oauth_data['bearer_auth']: headers['authorization'] = 'Bearer %s' % access_token @@ -193,6 +200,13 @@ def imports_get_token( 'Content-Type': 'application/json', 'user-agent': 'sanderroosendaal'} + if 'grant_type' in oauth_data: + if oauth_data['grant_type']: + post_data['grant_type'] = oauth_data['grant_type'] + else: + grant_type = post_data.pop('grant_type',None) + + if 'json' in oauth_data['content_type']: response = requests.post( base_uri, diff --git a/rowers/stravastuff.py b/rowers/stravastuff.py index de47568d..32587db8 100644 --- a/rowers/stravastuff.py +++ b/rowers/stravastuff.py @@ -44,6 +44,7 @@ oauth_data = { 'expirydatename': '', 'bearer_auth': True, 'base_url': "https://www.strava.com/oauth/token", + 'grant_type': None, }