0

我正在尝试连接https://graph.microsoft.com/v1.0/informationProtection/threatAssessmentRequests

低于错误:401 {

“错误”: {

"code": "Unauthorized",

"message": "Required authentication information is either missing or not valid for the resource.",

"innerError": {

  "date": "2020-11-06T15:21:22",

  "request-id": "8f4d480e-2916-4501-904b-0ca13db9e85e",

  "client-request-id": "8f4d480e-2916-4501-904b-0ca13db9e85e"

我正在使用 python3.7 和代码看起来像:

token ="xyz.dslkdskds_123"
headers = {
    "Content-type": "application/json",
    "Authorization": "Bearer " + token
    }
query1={
  "@odata.type": "#microsoft.graph.urlAssessmentRequest","url": "info.cvx.com", "contentType":"url",
  "expectedAssessment": "block", "category": "phishing"
}
url="https://graph.microsoft.com/v1.0/informationProtection/threatAssessmentRequests"
r = requests.post(url, headers=headers,data=json.dumps(query1))
4

1 回答 1

0

当我在图形资源管理器中运行以下查询而没有所需权限时面临同样的问题

GET https://graph.microsoft.com/v1.0/informationProtection/threatAssessmentRequests

在此处输入图像描述

"error": {
    "code": "Unauthorized",
    "message": "Required authentication information is either missing or not valid for the resource."

但是在提供所需的权限后 ThreatAssessment.ReadWrite.All能够获取数据

在此处输入图像描述

于 2020-12-14T19:01:31.100 回答