mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
docs(api): use correct parameters for withings auth
This commit is contained in:
parent
d129eaf912
commit
74e5a91f60
|
@ -7,14 +7,19 @@ async function getToken(code) {
|
||||||
code: code,
|
code: code,
|
||||||
grant_type: 'authorization_code',
|
grant_type: 'authorization_code',
|
||||||
action: 'requesttoken',
|
action: 'requesttoken',
|
||||||
redirect_uri: 'https://ohmyposh.dev',
|
redirect_uri: 'https://ohmyposh.dev/api/auth',
|
||||||
};
|
};
|
||||||
|
|
||||||
const resp = await axios.post('https://wbsapi.withings.net/v2/oauth2', null, { params: params });
|
const resp = await axios.post('https://wbsapi.withings.net/v2/oauth2', null, { params: params });
|
||||||
|
|
||||||
|
if (resp.data.error) {
|
||||||
|
throw resp.data.error;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
access_token: resp.data.access_token,
|
access_token: resp.data.body.access_token,
|
||||||
refresh_token: resp.data.refresh_token,
|
refresh_token: resp.data.body.refresh_token,
|
||||||
expires_in: resp.data.expires_in
|
expires_in: resp.data.body.expires_in
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,14 +30,14 @@ async function refreshToken(refresh_token) {
|
||||||
refresh_token: refresh_token,
|
refresh_token: refresh_token,
|
||||||
grant_type: 'refresh_token',
|
grant_type: 'refresh_token',
|
||||||
action: 'requesttoken',
|
action: 'requesttoken',
|
||||||
redirect_uri: 'https://ohmyposh.dev',
|
redirect_uri: 'https://ohmyposh.dev/api/auth',
|
||||||
};
|
};
|
||||||
const resp = await axios.post('https://wbsapi.withings.net/v2/oauth2', null, { params: params });
|
const resp = await axios.post('https://wbsapi.withings.net/v2/oauth2', null, { params: params });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
access_token: resp.data.access_token,
|
access_token: resp.data.body.access_token,
|
||||||
refresh_token: resp.data.refresh_token,
|
refresh_token: resp.data.body.refresh_token,
|
||||||
expires_in: resp.data.expires_in
|
expires_in: resp.data.body.expires_in
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue