gpt4 book ai didi

microsoft-graph-api - Onedrive API 拒绝访问 token (CompactToken 解析失败,错误代码为 : 8004920A)

转载 作者:行者123 更新时间:2023-12-02 17:00:31 26 4
gpt4 key购买 nike

希望我遗漏了一些非常简单的东西。根据this documentation要获得访问 token ,我需要点击以下网址:

https://login.live.com/oauth20_authorize.srf?client_id={client_id}&scope={scope}
&response_type=token&redirect_uri={redirect_uri}

到目前为止,这似乎是有效的,因为我得到的返回 url 包含

/#access_token=EwAYA61DBAAUcSSzo.......

根据上面的 token 流文档,

You can use the value of access_token to make requests to the OneDrive API.

根据 this页面,

Your app provides the access token in each request, through an HTTP header:

Authorization: bearer {token}

当运行 curl 时,我给它我之前得到的确切 token ,

curl -X GET \
https://graph.microsoft.com/v1.0/drive \
-H 'Authorization: Bearer EwAYA61DBAAUcSSzoTJJs.....

{
"error": {
"code": "InvalidAuthenticationToken",
"message": "CompactToken parsing failed with error code: 8004920A",
"innerError": {
"request-id": "8780c600-2b7f-45a0-b484-7eca9dfd2697",
"date": "2019-01-25T19:33:22"
}
}
}

为什么他们提供的 token 不起作用?

到目前为止我尝试了什么:

  • 更改标题中承载的大小写
  • 在 {}
  • 中包装所述 token
  • 生成新的代币
  • URL 解码所述 token

需要注意的一件事:我收到的 token 不是 JWT token 。谷歌搜索错误代码会出现几个 Stack Overflow 问题,这些问题似乎暗示图形 API 需要 JWT。如果是这种情况,我是否错过了获得它的步骤?

最佳答案

完成 Microsoft 帐户(OneDrive 个人版)的身份验证流程后,您无法调用 Microsoft Graph API。

另外,不再推荐使用微软账户的授权流程according the docs并且应该使用 Microsoft Graph 开发新的应用程序:

This topic contains information about authorizing an application using Microsoft accounts for OneDrive personal. However, this approach is no longer recommended. New applications should be developed using Microsoft Graph and follow the authorization process in Authorization and sign-in for OneDrive in Microsoft Graph.

关于microsoft-graph-api - Onedrive API 拒绝访问 token (CompactToken 解析失败,错误代码为 : 8004920A),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54372617/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com