1
與Cognito用戶羣驗證成功後AWS API網關我臨時憑證訪問AWS資源X-AMZN-錯誤類型:UnrecognizedClientException同時呼籲臨時證書
var akey='';
var skey='';
var st='';
AWS.config.credentials.get(function (err) {
akey = AWS.config.credentials.accessKeyId;
skey = AWS.config.credentials.secretAccessKey;
st = AWS.config.credentials.sessionToken;
var identityId = AWS.config.credentials.identityId;
});
使用這些證書我調用的API,其使用IAM授權
function ViewMyBookings_With_Credentials() {
debugger;
var apigClient = apigClientFactory.newClient({
accessKey: akey,
secretKey: skey,
sessionToken: st,
region: 'ap-south-1'
});
var params = { };
var body = ''; // Get Request
var additionalParams = { };
apigClient.mybookingsGet(params, body, additionalParams)
.then(function (result) {
//This is where you would put a success callback
alert(result.data);
}).catch(function (result) {
debugger;
alert(result.data);
//This is where you would put an error callback
});
}
OPTIONS請求成功,我得到了200 OK對於 但對於實際請求顯示CORS錯誤,我確信CORS沒有問題。 響應頭被示出
的x AMZN-錯誤類型:UnrecognizedClientException X-緩存:錯誤從CloudFront的
我搜索上AWS文檔這一點,但沒有得到任何積極的反應。
One Question addressing similar issue
但答案是不正確的/完整的,請讓我知道我錯過了什麼。
「響應標題顯示」...包括CORS標題? – UXDart