0
我得到消息MSAL的Web API授權已被拒絕了這個請求錯誤
{ "Message": "Authorization has been denied for this request." }
試圖如下面的截圖郵遞員看到使用API從
https://github.com/AzureADQuickStarts/AppModelv2-WebAPI-DotNet當
:
我試圖從js文件中調用它
$.ajax({
type: "GET",
url: window.config.webApi + "TodoList/Get",
headers: {
'Authorization': 'Bearer ' + accessToken,
},
}).done(function (data) {
logMessage("Web APi returned:\n" + JSON.stringify(data));
})
.fail(function (jqXHR, textStatus) {
logMessage("Error calling the Web api:\n" + textStatus);
});
你可以發佈你的WebAPI控制器代碼嗎?同時發佈Web API的啓動類的代碼 –
您需要在諸如jwt.io之類的服務中檢查訪問令牌。檢查受衆羣體聲明是否與您的API匹配。 – juunas