[来宾用户使用Microsoft图形API获得计划程序任务时出现401错误

问题描述 投票:0回答:1

使用来宾用户的令牌执行以下代码会导致401错误。直到几天前它都运行良好。

### Send GET bucket tasks list using guest user token. => 401 Unauthorized
GET https://graph.microsoft.com/v1.0/planner/buckets/{{bucketId}}/tasks
Content-Type: application/json
Authorization: Bearer {{guestToken}}

# Response
HTTP/1.1 401 Unauthorized
Cache-Control: private
Content-Type: application/json
request-id: 151d7cb2-a9ee-4983-8336-c8da1cfabaca
client-request-id: 151d7cb2-a9ee-4983-8336-c8da1cfabaca
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"Japan East","Slice":"SliceC","Ring":"2","ScaleUnit":"002","RoleInstance":"AGSFE_IN_16"}}
Strict-Transport-Security: max-age=31536000
Date: Mon, 13 Apr 2020 06:47:06 GMT
Connection: close
Content-Length: 1569

{
  "error": {
    "code": "UnknownError",
    "message": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"/>\r\n<title>401 - Unauthorized: Access is denied due to invalid credentials.</title>\r\n<style type=\"text/css\">\r\n<!--\r\nbody{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}\r\nfieldset{padding:0 15px 10px 15px;} \r\nh1{font-size:2.4em;margin:0;color:#FFF;}\r\nh2{font-size:1.7em;margin:0;color:#CC0000;} \r\nh3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} \r\n#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:\"trebuchet MS\", Verdana, sans-serif;color:#FFF;\r\nbackground-color:#555555;}\r\n#content{margin:0 0 0 2%;position:relative;}\r\n.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}\r\n-->\r\n</style>\r\n</head>\r\n<body>\r\n<div id=\"header\"><h1>Server Error</h1></div>\r\n<div id=\"content\">\r\n <div class=\"content-container\"><fieldset>\r\n  <h2>401 - Unauthorized: Access is denied due to invalid credentials.</h2>\r\n  <h3>You do not have permission to view this directory or page using the credentials that you supplied.</h3>\r\n </fieldset></div>\r\n</div>\r\n</body>\r\n</html>\r\n",
    "innerError": {
      "request-id": "151d7cb2-a9ee-4983-8336-c8da1cfabaca",
      "date": "2020-04-13T06:47:06"
    }
  }
}

如果不是访客用户,我可以通过相同的请求获得任务。

### Send GET bucket tasks list Tasks using UserToken. => 200 OK
GET https://graph.microsoft.com/v1.0/planner/buckets/{{bucketId}}/tasks
Content-Type: application/json
Authorization: Bearer {{token}}

# Response
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
....

我可以获得与来宾用户相同的令牌的onenote笔记本。

### Send Get Onenote notebooks using guest user token. => 200 OK
GET https://graph.microsoft.com/v1.0/groups/{{groupId}}/onenote/notebooks
Content-Type: application/json
Authorization: Bearer {{guestToken}}

# Response
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
....

还要确保所需的作用域由JWT.IO授予。

jwt.io

我认为错误是由于Graph Api方面的某些更新,但不知道解决方案?

microsoft-graph microsoft-planner
1个回答
0
投票

Graph API现在已修复。谢谢。

© www.soinside.com 2019 - 2024. All rights reserved.