我正在创建带有帐户链接的 Alexa 技能。我得到了链接授权码并将其换成了访问令牌。然后,我尝试将所有参数:代码、访问令牌、技能 ID 放入 Alexa 技能激活 API。我总是得到一个按摩:“无效的帐户链接凭据”。
var clientServerOptions = {
uri: `https://api.amazonalexa.com/v1/users/~current/skills/${SkillId}/enablement`,
body: JSON.stringify({
stage: "development",
accountLinkRequest: {
redirectUri: "https://api.amazon.com/auth/o2/token",
authCode: req.body.code, //the code I got from the start
type: "AUTH_CODE"
}
}),
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${req.body.access_token}` //my access token
}
}
request(clientServerOptions, function (error, response) {
if(error != null) {
console.error(error);
} else {
console.log(response.body);
}
return;
});
该怎么办?