图表API:令牌

时间:2016-03-07 08:59:09

标签: onedrive microsoft-graph azure-ad-graph-api

我正在尝试使用MS Graph API从OneDrive for Business获取文件/文件夹列表。我已经在Graph Explorer中成功执行了我需要的查询,现在我正在继续在我的项目中实现。

我的应用是Windows服务,因此我使用this method

获取令牌

我已成功检索到令牌,但当我“获取”此网址时... //graph.microsoft.com/v1.0/users('someuseraccount')/drive/items/somedriveitem/microsoft.graph.createLink

...我收到了错误回复:

  

令牌中需要存在scp或角色声明。

来自服务器的令牌响应如下:

{
  "token_type": "Bearer",
  "expires_in": "3600",
  "scope": "Directory.AccessAsUser.All Files.Read Files.Read.Selected Files.ReadWrite Files.ReadWrite.AppFolder Files.ReadWrite.Selected profile Sites.Read.All User.Read",
  "expires_on": "1457343736",
  "not_before": "1457339836",
  "resource": "https://graph.microsoft.com",
  "access_token": "-the token-"
}

1 个答案:

答案 0 :(得分:3)

您的客户端应用程序似乎只向Microsoft Graph请求了委派权限,而应该为此处尝试的方案请求应用程序权限。以下是Azure门户中的应用程序权限部分的图示。请选择所需的适当权限并重试。 application permission illustration