feat: Convert all app files to JS
This commit is contained in:
19
packages/backend/src/apps/strava/auth/verify-credentials.js
Normal file
19
packages/backend/src/apps/strava/auth/verify-credentials.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const verifyCredentials = async ($) => {
|
||||
const params = {
|
||||
client_id: $.auth.data.clientId,
|
||||
client_secret: $.auth.data.clientSecret,
|
||||
code: $.auth.data.code,
|
||||
grant_type: 'authorization_code',
|
||||
};
|
||||
const { data } = await $.http.post('/v3/oauth/token', null, { params });
|
||||
|
||||
await $.auth.set({
|
||||
accessToken: data.access_token,
|
||||
refreshToken: data.refresh_token,
|
||||
tokenType: data.token_type,
|
||||
athleteId: data.athlete.id,
|
||||
screenName: `${data.athlete.firstname} ${data.athlete.lastname}`,
|
||||
});
|
||||
};
|
||||
|
||||
export default verifyCredentials;
|
Reference in New Issue
Block a user