Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Microsoft graph api Microsoft OneDrive和SharePoint_Microsoft Graph Api_Onedrive - Fatal编程技术网

Microsoft graph api Microsoft OneDrive和SharePoint

Microsoft graph api Microsoft OneDrive和SharePoint,microsoft-graph-api,onedrive,Microsoft Graph Api,Onedrive,我试图从MS OneDrive访问我的文件,但作为响应,它给出了未经授权访问的错误信息。 我已刷新我的访问令牌,且应用有效并已注册到MS应用注册门户 我在网上查了一下,没有找到解决办法 请在下面找到代码。 关注的方法是authorize和accessandrefreshttoken 此外,我使用不同的工具收到不同的错误 使用邮递员时,错误为: { "error": { "code": "InvalidAuthenticationToken", "message": "Bear

我试图从MS OneDrive访问我的文件,但作为响应,它给出了未经授权访问的错误信息。 我已刷新我的访问令牌,且应用有效并已注册到MS应用注册门户

我在网上查了一下,没有找到解决办法

请在下面找到代码。 关注的方法是authorize和accessandrefreshttoken

此外,我使用不同的工具收到不同的错误

使用邮递员时,错误为:

{
  "error": {
    "code": "InvalidAuthenticationToken",
    "message": "Bearer access token is empty.",
    "innerError": {
      "request-id": "729c6cdc-6b9e-4874-b012-5e8bdd2d91da",
      "date": "2017-04-11T17:35:47"
    }
  }
}
即使我在请求中提供了访问令牌,也会显示此错误

使用时:

我的请求是这样的:

GET https://graph.microsoft.com/v1.0/me/drive
--header Content-Length: 0
--header Authorization: bearer {access_token}

我试着用v2.0代替v1.0,用Bearer代替Bearer。不走运。

您将使用旧MSA和现代v2身份验证位的组合

您确认URL不正确。应该是https://login.microsoftonline.com/common/oauth2/v2.0/token.

您也没有请求任何权限范围。最终结果将是一个无法访问任何内容的令牌。您可能至少需要User.Read和Files.ReadWrite


看一看,让我们来看看

请包含您的代码,并显示错误发生的位置以及错误的详细信息(如果是异常)及其类型等。抱歉@Richard有点晚了,我已经更新了我的问题。已经谢谢你了!
GET https://graph.microsoft.com/v1.0/me/drive
--header Content-Length: 0
--header Authorization: bearer {access_token}