当试图在Microsoft图表中列出“我”的目录项时,我收到400错误请求,并显示以下错误消息:“缺少必要的用户声明。”Microsoft Graph无法列出目录文件
重现步骤:
- 通过Application Registration Tool创建应用程序,授予权限
Files.Read
使用创建客户端ID和客户端密钥来获得令牌(以下其guide)卷曲:
curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d 'grant_type=client_credentials&client_id=<client-id>&client_secret=<client-secret>=&resource=https://graph.microsoft.com' "https://login.microsoftonline.com/<my-tenant-id>/oauth2/token"
使用创建的
<Access-Token>
来制作一个要求列出根目录像(卷曲):curl -X GET -H "Authorization: Bearer <Access-Token>" -H "Cache-Control: no-cache" "https://graph.microsoft.com/v1.0/me/drive/root/children"
获取响应:
400 Bad Request
{
"error": {
"code": "BadRequest",
"message": "Missing necessary user claims.",
"innerError": {
"request-id": "36c384f4-1810-4d96-ad69-d69a67d11ece",
"date": "2016-05-31T14:39:05"
}
}
}
任何帮助,将不胜感激