【问题标题】:Issue with RestAPI for threatAssessmentRequests using Microsoftgraph使用 Microsoft Graph 的威胁评估请求的 Rest API 问题
【发布时间】:2020-11-06 15:47:24
【问题描述】:

我正在尝试与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))

【问题讨论】:

  • 能否请您提供所需的权限 Delegated(工作或学校帐户) ThreatAssessment.ReadWrite.All
  • 使用jwt.ms 解析您的访问令牌并提供屏幕截图。
  • 您在这个问题上还需要帮助吗?如果是,请分享上述信息。
  • @SruthiJ-MSFTIdentity :您好 Sruthi,我已获得许可。 "user.read","mail.send","ThreatAssessment.ReadWrite.All","ThreatAssessment.Read.All"
  • 我在 MS 门户中发现了“威胁评估权限仅对工作或学校帐户有效”的评论。是不是表示企业账号不支持这个功能?

标签: microsoft-graph-api office365api microsoft-information-protection


【解决方案1】:

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

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 能够获取数据

【讨论】:

  • 感谢您的回复。我已授予这些权限。当我使用 Oauth2.0 方法进行授权时,我得到了令牌,并且能够为 informationProtection/threatAssessmentRequests 进行发布和获取方法。但是我必须在浏览器中手动输入凭据,然后才能获得令牌。有没有办法在不输入手动凭据的情况下完成身份验证和生成令牌?
  • 这种情况可以使用client credential flow
猜你喜欢
  • 2020-10-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-03-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多