【发布时间】:2021-04-10 12:10:19
【问题描述】:
我正在创建一个带有帐户链接的 Alexa 技能。我设法获得了访问令牌,但现在我尝试调用 Alexa Skill Activation API,但总是出现错误。 我把我的代码和我的错误放在这里:
fetch(`https://api.amazonalexa.com/v1/users/~current/skills/{SkillId}/enablement`, {
method: 'post',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${access_token}`
},
body: JSON.stringify({
stage: "development",
accountLinkRequest: {
redirectUri: "https://my.url.com/alexa/",
authCode: code,
type: "AUTH_CODE"
}
})
}).then(res=>res.json()).then(response=>{
alert(JSON.stringify(response));
}).catch(err=>alert(err));
我该怎么办?
【问题讨论】:
-
它是正确的端点吗?根据用户/您的位置,它可能是
api.eu.amazonalexa.com或api.fe.amazonalexa.com。 -
您好,您是如何获得在请求正文中使用的用户身份验证代码的?谢谢
标签: javascript reactjs fetch alexa alexa-skill