Microsoft Graph 是否支持 URI 中的 OAuth 2.0 令牌?
Does Microsoft Graph support OAuth 2.0 tokens in URIs?
我正在尝试将 Odoo 11 配置为通过 OAuth 2.0 与我们在 Microsoft Azure AD 上的业务目录一起使用。
Odoo 11 使用隐式方法获取令牌 - 这似乎工作正常,我可以从 https://login.microsoftonline.com/<company_domain>/oauth2/v2.0/authorize
端点获取有效令牌。
然后使用RFC6750第2.3节中描述的方法读取端点数据。此方法涉及向 https://graph.microsoft.com/v1.0/me?access_token=<access_token>
发送查询
我知道令牌是有效的,因为我可以使用 https://www.hurl.it
通过 Authorization: Bearer <access_token>
的请求 header 向 https://graph.microsoft.com/v1.0/me
发送查询,并且我得到了预期的结果.这是根据 RFC6750 第 2.1 节中描述的方法,这是我在 Microsoft 文档中遇到的唯一方法。
如果我根据第 2.3 节手动尝试发送请求,我会收到来自 Microsoft Graph 的错误响应:
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "Bearer access token is empty.",
"innerError": {
"request-id": "2319fe00-8695-481d-8850-d1b8ed973292",
"date": "2018-01-23T19:12:15"
}
}
}
所以我的问题是:Microsoft Graph是否支持RFC6750第2.3节中的请求方法?
据我所知,没有。在 documentation 他们说:
Once you have an access token, you can use it to call Microsoft Graph by including it in the Authorization header of a request. The following request gets the profile of the signed-in user.
没有提到其他的,而且我从未见过提到的那种方法。
也许您需要某种介于两者之间的代理来获取查询参数并将其移动到 header?
Microsoft Graph 支持 Authorization Request Header Field method. The Form-Encoded Body Parameter and URI Query Parameter 方法,但不支持。
值得注意的是,查询参数方法存在一个显着的安全问题:
Because of the security weaknesses associated with the URI method
(see Section 5), including the high likelihood that the URL
containing the access token will be logged, it SHOULD NOT be used
unless it is impossible to transport the access token in the
"Authorization" request header field or the HTTP request entity-body.
我正在尝试将 Odoo 11 配置为通过 OAuth 2.0 与我们在 Microsoft Azure AD 上的业务目录一起使用。
Odoo 11 使用隐式方法获取令牌 - 这似乎工作正常,我可以从 https://login.microsoftonline.com/<company_domain>/oauth2/v2.0/authorize
端点获取有效令牌。
然后使用RFC6750第2.3节中描述的方法读取端点数据。此方法涉及向 https://graph.microsoft.com/v1.0/me?access_token=<access_token>
我知道令牌是有效的,因为我可以使用 https://www.hurl.it
通过 Authorization: Bearer <access_token>
的请求 header 向 https://graph.microsoft.com/v1.0/me
发送查询,并且我得到了预期的结果.这是根据 RFC6750 第 2.1 节中描述的方法,这是我在 Microsoft 文档中遇到的唯一方法。
如果我根据第 2.3 节手动尝试发送请求,我会收到来自 Microsoft Graph 的错误响应:
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "Bearer access token is empty.",
"innerError": {
"request-id": "2319fe00-8695-481d-8850-d1b8ed973292",
"date": "2018-01-23T19:12:15"
}
}
}
所以我的问题是:Microsoft Graph是否支持RFC6750第2.3节中的请求方法?
据我所知,没有。在 documentation 他们说:
Once you have an access token, you can use it to call Microsoft Graph by including it in the Authorization header of a request. The following request gets the profile of the signed-in user.
没有提到其他的,而且我从未见过提到的那种方法。
也许您需要某种介于两者之间的代理来获取查询参数并将其移动到 header?
Microsoft Graph 支持 Authorization Request Header Field method. The Form-Encoded Body Parameter and URI Query Parameter 方法,但不支持。
值得注意的是,查询参数方法存在一个显着的安全问题:
Because of the security weaknesses associated with the URI method (see Section 5), including the high likelihood that the URL containing the access token will be logged, it SHOULD NOT be used unless it is impossible to transport the access token in the "Authorization" request header field or the HTTP request entity-body.