diff --git a/docs/api/auth/index.js b/docs/api/auth/index.js index 2f4a159f..c98514e3 100644 --- a/docs/api/auth/index.js +++ b/docs/api/auth/index.js @@ -31,7 +31,7 @@ module.exports = async function (context, req) { redirect(context, segment, tokens, ''); } catch (error) { context.log(`Error: ${error.stack}`); - let buff = new Buffer(error.stack); + let buff = Buffer.from(error.stack); let message = buff.toString('base64'); redirect(context, segment, tokens, message); } diff --git a/docs/api/shared/strava.js b/docs/api/shared/strava.js index 6b075f48..8ca18299 100644 --- a/docs/api/shared/strava.js +++ b/docs/api/shared/strava.js @@ -9,11 +9,11 @@ async function getStravaToken(code) { }; const resp = await axios.post('https://www.strava.com/api/v3/oauth/token', null, { params: params }); - const body = { + return { access_token: resp.data.access_token, refresh_token: resp.data.refresh_token, - } - return body; + expires_in: resp.data.expires_in + }; } async function refreshStravaToken(refresh_token) { @@ -25,11 +25,11 @@ async function refreshStravaToken(refresh_token) { }; const resp = await axios.post('https://www.strava.com/api/v3/oauth/token', null, { params: params }); - const body = { + return { access_token: resp.data.access_token, refresh_token: resp.data.refresh_token, - } - return body; + expires_in: resp.data.expires_in + }; } module.exports = {