mast/integrations/utils.py
def save_strava_tokens(auth_code):
    ''' Acquire authentication and refresh token as well as info about an athlete with an authentication code.
    '''

    url = 'https://www.strava.com/oauth/token'
    data = {
        'client_id': current_app.config['STRAVA_CLIENT_ID'],
        'client_secret': current_app.config['STRAVA_CLIENT_SECRET'],
        'code': auth_code,
        'grant_type': 'authorization_code'
    }
    response = requests.post(url, data=data)
    response_data = json.loads(response.text)

    # This is JSON containing access and refresh token as well as athlete info
    strava_logger.info( json.dumps(response_data, indent=4))

    current_user.strava_id = response_data["athlete"]["id"]
    current_user.strava_refresh_token = response_data["refresh_token"]
    current_user.strava_access_token = response_data["access_token"]
 Acquire authentication and refresh token as well as info about an athlete with an authentication code.
    
Acquire authentication and refresh token as well as info about an athlete with an authentication code.
Acquire authentication and refresh token as well as info about an athlete with an authentication code .
def save_strava_tokens(auth_code):
    url = 'https://www.strava.com/oauth/token'
    data = {
        'client_id': current_app.config['STRAVA_CLIENT_ID'],
        'client_secret': current_app.config['STRAVA_CLIENT_SECRET'],
        'code': auth_code,
        'grant_type': 'authorization_code'
    }
    response = requests.post(url, data=data)
    response_data = json.loads(response.text)
    strava_logger.info( json.dumps(response_data, indent=4))
    current_user.strava_id = response_data["athlete"]["id"]
    current_user.strava_refresh_token = response_data["refresh_token"]
    current_user.strava_access_token = response_data["access_token"]
def save_strava_tokens ( auth_code ) : url = 'https://www.strava.com/oauth/token' data = { 'client_id' : current_app . config [ 'STRAVA_CLIENT_ID' ] , 'client_secret' : current_app . config [ 'STRAVA_CLIENT_SECRET' ] , 'code' : auth_code , 'grant_type' : 'authorization_code' } response = requests . post ( url , data = data ) response_data = json . loads ( response . text ) strava_logger . info ( json . dumps ( response_data , indent = 4 ) ) current_user . strava_id = response_data [ "athlete" ] [ "id" ] current_user . strava_refresh_token = response_data [ "refresh_token" ] current_user . strava_access_token = response_data [ "access_token" ]
Acquire authentication and refresh token as well as info about an athlete with an authentication code.
Acquire authentication and refresh token as well as info about an athlete with an authentication code .
''' Acquire authentication and refresh token as well as info about an athlete with an authentication code.
    ''' # This is JSON containing access and refresh token as well as athlete info
auth_code