2023-08-04 19:08:16 -04:00
|
|
|
const k_client_id = '28276';
|
|
|
|
const k_client_secret = '3123f1f5afe132d9731111066d1d17bdb22ef27e';
|
|
|
|
const k_access_token = 'f753e77764c26252bd2d80e7c5cc17ace51a8864';
|
|
|
|
const k_refresh_token = 'f58d8e1b5a3ec3bf96e681589d5014f9a294f5a4';
|
|
|
|
const k_redirect_url = 'https://tildefriends.net/~cory/gg/login';
|
|
|
|
|
|
|
|
export async function refresh_token(token) {
|
|
|
|
let r = await fetch('https://www.strava.com/api/v3/oauth/token', {
|
|
|
|
method: 'POST',
|
|
|
|
body: `client_id=${k_client_id}&client_secret=${k_client_secret}&refresh_token=${token.refresh_token}&grant_type=refresh_token`,
|
|
|
|
});
|
|
|
|
return r?.body ? JSON.parse(utf8Decode(r.body)) : undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function authorization_code(code) {
|
|
|
|
return await fetch('https://www.strava.com/api/v3/oauth/token', {
|
|
|
|
method: 'POST',
|
|
|
|
body: `client_id=${k_client_id}&client_secret=${k_client_secret}&code=${code}&grant_type=authorization_code`,
|
|
|
|
});
|
2024-02-24 11:09:34 -05:00
|
|
|
}
|