[英]Can't get Extended User Access Token from Facebook with OAuth2 NodeJS
[英]Can't get access token from amazon
我正在嘗試在“授權 CodeGrant”之后添加亞馬遜登錄,我獲取代碼客戶端並將其發送到我的節點 js 快遞服務器,但無法從亞馬遜獲取訪問令牌。 我收到 500 內部存儲錯誤,並且:
x-amzn-errortype': 'InternalFailure:http://internal.amazon.com/coral/com.amazon.coral.service/'
我的代碼:
async function getAmazonAccessTokenFromCode(code) {
try {
const { data } = await axios({
url: 'https://api.amazon.com/auth/o2/token',
method: 'POST',
headers: {
"Content-type": "application/x-www-form-urlencoded"
},
params: {
grant_type: "authorization_code",
code,
client_id: "my_client_id",
client_secret: "my_client_secret",
redirect_uri: 'http://localhost:3000/amazon-auth',
}
})
console.log("data", data)
return data.access_token
} catch (err) {
console.log("err", err)
return null
}
}
我通過在 axios 獲取請求中將“參數”替換為“數據”來使其工作。
此外,如果它不起作用,請嘗試在內容類型中使用 application/json。 它對我有用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.