async function exchangeCodeForAthleteInfo(code) {
  try {
    const response = await fetch(`${stravaOauthUrl}/token`, {
      method: 'POST',
      body: getTokenRequestBody(code),
    });

    if (response.status !== 200) {
      return getErrorResponseObject(20);
    }

    const tokenExchangeResponse = await response.json();

    // @note Use new token refresh logic
    if (!tokenExchangeResponse || !tokenExchangeResponse.access_token) {
      return getErrorResponseObject(30, tokenExchangeResponse);
    }

    return tokenExchangeResponse;
  } catch (err) {
    return getErrorResponseObject(40);
  }
}
/**
 * OAuth exchange from initial authorization callback
 *
 * @param {String} code
 * @return {Object} Raw athlete object from Strava API
 */
OAuth exchange from initial authorization callback
@param {String} code
@return {Object} Raw athlete object from Strava API
OAuth exchange from initial authorization callback @param { String } code @return { Object } Raw athlete object from Strava API
async function exchangeCodeForAthleteInfo(code) {
  try {
    const response = await fetch(`${stravaOauthUrl}/token`, {
      method: 'POST',
      body: getTokenRequestBody(code),
    });
    if (response.status !== 200) {
      return getErrorResponseObject(20);
    }
    const tokenExchangeResponse = await response.json();
    if (!tokenExchangeResponse || !tokenExchangeResponse.access_token) {
      return getErrorResponseObject(30, tokenExchangeResponse);
    }
    return tokenExchangeResponse;
  } catch (err) {
    return getErrorResponseObject(40);
  }
}
async function exchangeCodeForAthleteInfo ( code ) { try { const response = await fetch ( ` ${ stravaOauthUrl } ` , { method : 'POST' , body : getTokenRequestBody ( code ) , } ) ; if ( response . status !== 200 ) { return getErrorResponseObject ( 20 ) ; } const tokenExchangeResponse = await response . json ( ) ; if ( ! tokenExchangeResponse || ! tokenExchangeResponse . access_token ) { return getErrorResponseObject ( 30 , tokenExchangeResponse ) ; } return tokenExchangeResponse ; } catch ( err ) { return getErrorResponseObject ( 40 ) ; } }
OAuth exchange from initial authorization callback
 @param {String} code
 @return {Object} Raw athlete object from Strava API
OAuth exchange from initial authorization callback @param { String } code @return { Object } Raw athlete object from Strava API
// @note Use new token refresh logic