gpt4 book ai didi

oauth-2.0 - OAuth 2.0 重定向 URL 中是否支持查询字符串参数?

转载 作者:行者123 更新时间:2023-12-05 01:28:22 27 4
gpt4 key购买 nike

我想确保我正确理解了(草案)规范,其中指出:

The redirection endpoint URI MUST be an absolute URI as defined by
[RFC3986] section 4.3. The endpoint URI MAY include an
"application/x-www-form-urlencoded" formatted
([W3C.REC-html401-19991224]) query component ([RFC3986] section 3.4), which MUST be retained when adding additional query parameters. The
endpoint URI MUST NOT include a fragment component.



我问的原因是 Google 或 Facebook 似乎都没有保留任何查询字符串。

最佳答案

重新阅读规范,似乎规范的引用部分不适用于 OAuth 服务器对 URI 的处理,但适用于 OAuth 客户端对给定的原始端点 URI 的处理。

换句话说,如果我说在重定向到我的服务器进行 OAuth 授权时必须使用的 OAuth 端点是:

http://example.com/oauth.php?endpoint=token

然后当客户端添加 ?response_type=code&client_id=...&state=...&redirect_uri=...对于 URI,不允许丢弃原始端点 uri 中的“?endpoint=token”,并且必须使用 URI:
http://example.com/oauth.php?endpoint=token&response_type=code&client_id=...&state=...&redirect_uri=...

因此,至少就规范的那部分而言,没有任何内容表明 Facebook、Google 等必须保留除“状态”参数之外的任何未知查询参数。

从技术上讲,您可以使用 &state=以 JSON 格式传递自定义数据的参数。虽然这可能会也可能不会。 IIRC 我注意到当您使用特殊字符时,Meetup 的 OAuth 2 实现似乎会破坏状态。我认为是违反规范的。

关于oauth-2.0 - OAuth 2.0 重定向 URL 中是否支持查询字符串参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10436924/

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