onedrive - 图形API : Either scp or roles claim need to be present in the token

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

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

我的应用程序是 Windows 服务,因此我使用 this method 获取 token

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

...我收到带有错误的响应:

Either scp or roles claim need to be present in the token.

我的服务器的 token 响应如下:

{
  "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-"
}

最佳答案

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

关于onedrive - 图形API : Either scp or roles claim need to be present in the token,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35839675/

相关文章:

windows-phone-8 - WP8 + 将文件上传到 Skydrive

ms-word - Office URI 方案,来自模板(nft)的新文件未将文件保存在提供的位置

c# - 通过共享链接 (URL) 获取 OneDrive 文件夹的内容

azure - 无法从 Dynamics 365 Customer Insights 平台接收正确的预测数据

azure - 在 Powershell 中使用从 AzureRmContext 获取的 token 后,AD 图形 API 的访问 token 验证失败

vb.net - 如何在没有 API 的情况下查找 OneDrive (SkyDrive) 和 GoogleDrive 文件夹?

azure - 具有 Azure AD v2.0 身份验证的 Sharepoint Online REST API

azure - 使用 .NET Core(API 和 HTTP)创建 Azure AD 应用程序和服务主体

azure - 是否可以使用 Powershell 更新 Azure AD 中现有用户的 SignInNames

authorization - 将 Office365 App "Read mail in All mailboxes"权限限制为特定邮箱