Outlook API invalid_token 错误
Outlook API invalid_token error
我正尝试通过以下请求调用 outlook API:
https://outlook.office.com/api/v2.0/me/calendars
GET
Authorization: Bearer [my fresh bearer token]
登录并获得用户同意后,我从令牌端点成功检索了 access_token。
但是,我尝试的每个请求 returns 401 Unauthorized with the following header (显示一个原因对我来说看起来很奇怪):
WwwAuthenticate [HttpHeaderValueCollection]: {Bearer client_id="00000002-0000-0ff1-ce00-000000000000", trusted_issuers="00000001-0000-0000-c000-000000000000@*", token_types="app_asserted_user_v1 service_asserted_app_v1", authorization_uri="https://login.windows.net/common/oauth2/authorize", error="invalid_token", Basic Realm="", Basic Realm="", Basic Realm=""}
可以看到,最后有error="invalid_token"
还有app_asserted_user_v1service_asserted_app_v1
是否有什么东西是我忘记激活或正确配置的?
编辑:我确实找到了 但是如果我添加像 OP 这样的资源参数,我会得到 "Bad Request" 和这个代码:
AADSTS90100: The 'resource' request parameter is not supported.
好的,我自己找到了答案,希望对更多人有帮助:
问题甚至出现在之前,在我将用户重定向到 MS 登录页面的那一步。
那时我曾经给它以下范围:
openid Calendars.ReadWrite offline_access profile
但是,Calendars.ReadWrite 必须以其 "full" 名称传递,即:
HTH
我正尝试通过以下请求调用 outlook API:
https://outlook.office.com/api/v2.0/me/calendars
GET
Authorization: Bearer [my fresh bearer token]
登录并获得用户同意后,我从令牌端点成功检索了 access_token。
但是,我尝试的每个请求 returns 401 Unauthorized with the following header (显示一个原因对我来说看起来很奇怪):
WwwAuthenticate [HttpHeaderValueCollection]: {Bearer client_id="00000002-0000-0ff1-ce00-000000000000", trusted_issuers="00000001-0000-0000-c000-000000000000@*", token_types="app_asserted_user_v1 service_asserted_app_v1", authorization_uri="https://login.windows.net/common/oauth2/authorize", error="invalid_token", Basic Realm="", Basic Realm="", Basic Realm=""}
可以看到,最后有error="invalid_token"
还有app_asserted_user_v1service_asserted_app_v1
是否有什么东西是我忘记激活或正确配置的?
编辑:我确实找到了
AADSTS90100: The 'resource' request parameter is not supported.
好的,我自己找到了答案,希望对更多人有帮助:
问题甚至出现在之前,在我将用户重定向到 MS 登录页面的那一步。
那时我曾经给它以下范围:
openid Calendars.ReadWrite offline_access profile
但是,Calendars.ReadWrite 必须以其 "full" 名称传递,即:
HTH