Microsoft graph api 使用Microsoftgraph的威胁评估请求的RestAPI问题

Microsoft graph api 使用Microsoftgraph的威胁评估请求的RestAPI问题,microsoft-graph-api,office365api,microsoft-information-protection,Microsoft Graph Api,Office365api,Microsoft Information Protection,我正试着和你联系 获取以下错误: 401 { “错误”:{ 我正在使用python3.7,代码如下所示: token ="xyz.dslkdskds_123" headers = { "Content-type": "application/json", "Authorization": "Bearer " + token } query1={ "@odata

我正试着和你联系

获取以下错误: 401 {

“错误”:{

我正在使用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))

在graph explorer中运行下面的查询时,如果没有所需的权限,也会遇到同样的问题

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

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


您能否提供所需的授权(工作或学校帐户)ThreatAssessment.ReadWrite.AllUse解析您的访问令牌并提供屏幕截图。您还需要此问题的帮助吗?如果需要,请共享上面提到的信息。@SruthiJ MSFTIdentity:Hi Sruthi,我已授予权限。“user.read”、“mail.send”、“ThreatAssessment.ReadWrite.All”,“ThreatAssessment.Read.All”我在微软门户网站上发现这样一句话:“威胁评估权限仅对工作或学校帐户有效。"这是否意味着公司帐户不支持此功能?感谢您的回复。我已经授予了这些权限。当我使用Oauth2.0方法进行授权时,我获得了令牌,并且能够对信息保护/威胁评估请求执行post和get方法。但我必须在浏览器中手动输入凭据,然后只有我获得令牌.是否有任何方法可以在不输入手动凭证的情况下完成身份验证并生成令牌?在这种情况下,您可以使用
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."