我正在我的網站上實施 Strava。我是 JavaScript 新手,我不明白我這樣做是否正確。我的問題是我無法從 JSON 響應獲取訪問令牌。我不知道為什么。請幫我。我得到的反應代碼<script> const auth_link = "https://www.strava.com/oauth/token"function getActivites(res){console.log('response2',res.json()); const activities_link = `https://www.strava.com/api/v3/athlete/activities?access_token=${res.access_token}` fetch(activities_link) .then((res) => console.log(res.json()))}function reAuthorize(){ fetch(auth_link,{ method: 'post', headers: { 'Accept': 'application/json, text/plain, */*', 'Content-Type': 'application/json' }, body: JSON.stringify({ client_id: 'xxxx', client_secret: 'xxxxx', refresh_token: 'xxxxx', grant_type: 'refresh_token' }) }) .then(res => { var response = res.json(); var access_token = response.access_token; console.log('response',access_token) // getActivites(res) })}reAuthorize()</script>我得到的訪問令牌為undefined
無法從 json 響應獲取訪問令牌
MMMHUHU
2023-07-14 10:24:00