docs: expose expires_in for authentication

This commit is contained in:
Jan De Dobbeleer 2022-01-10 21:17:57 +01:00
parent bd39e2aa12
commit 00a09ca894
No known key found for this signature in database
GPG key ID: F6CC273CE5BA9AEE
2 changed files with 7 additions and 7 deletions

View file

@ -31,7 +31,7 @@ module.exports = async function (context, req) {
redirect(context, segment, tokens, ''); redirect(context, segment, tokens, '');
} catch (error) { } catch (error) {
context.log(`Error: ${error.stack}`); context.log(`Error: ${error.stack}`);
let buff = new Buffer(error.stack); let buff = Buffer.from(error.stack);
let message = buff.toString('base64'); let message = buff.toString('base64');
redirect(context, segment, tokens, message); redirect(context, segment, tokens, message);
} }

View file

@ -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 resp = await axios.post('https://www.strava.com/api/v3/oauth/token', null, { params: params });
const body = { return {
access_token: resp.data.access_token, access_token: resp.data.access_token,
refresh_token: resp.data.refresh_token, refresh_token: resp.data.refresh_token,
} expires_in: resp.data.expires_in
return body; };
} }
async function refreshStravaToken(refresh_token) { 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 resp = await axios.post('https://www.strava.com/api/v3/oauth/token', null, { params: params });
const body = { return {
access_token: resp.data.access_token, access_token: resp.data.access_token,
refresh_token: resp.data.refresh_token, refresh_token: resp.data.refresh_token,
} expires_in: resp.data.expires_in
return body; };
} }
module.exports = { module.exports = {