我们使用“令牌”和“自动键”发送请求,并在页面上提供服务ajax。但服务响应为“ StatusCodeError:401”。
var jsondata=JSON.stringify({
"Filter": [
{
"PropertyName": "ex",
"Operation": "EQ",
"PropertyValue": "ex"
}
],
"FilterCompareType": "AND",
"GetLayout": false
});
var options = {
method: 'POST',
url: 'url',
qs: {
access_token: 'Bearer <keycloak example>',
},
headers: {
'Authorization': 'example'
"contenttype":"application/json",
"Accept": "application/json",
},
data:jsondata,
dataType:'json'
};
promise(options)
.then(function (parsebody) {
console.log(parsebody);
})
.catch(function (err) {
console.log(err);
});