Microsoft Oauth解析状态参数作为字符串,但返回哈希

发布于 2025-01-28 08:08:27 字数 684 浏览 5 评论 0 原文

我正在使用Microsoft Identity平台和OAuth 2.0授权代码流来授权Microsoft Azure的用户信息。在我的Ruby代码中,我将状态参数解析到Microsoft:

config.omniauth :azure_oauth2, client_id: "xxxxxxxxxxxx", client_secret: "xxxxxxxxxxxx", tenant_id: "xxxxxxxxxxxx", scope: "user.read", state: "development", response_type: "token", response_mode: "query"

我应该接收一个与我发送的相同值(“开发”)的状态参数。但是,在微软收到我的请求之后,我似乎有一个哈希价值:

https://login.microsoftonline.com/xxxxxxxx&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fomniauth%2Fazure_oauth2%2Fcallback&response_type=code&scope=user.read&state=6ff45c77bf433d3bf33dd8df956fda77d62467c0b29b6f4c&sso_reload=true

有什么想法吗?谢谢。

I'm using the Microsoft identity platform and OAuth 2.0 authorization code flow to authorize user information from Microsoft Azure. In my Ruby code I parse the state parameter to microsoft:

config.omniauth :azure_oauth2, client_id: "xxxxxxxxxxxx", client_secret: "xxxxxxxxxxxx", tenant_id: "xxxxxxxxxxxx", scope: "user.read", state: "development", response_type: "token", response_mode: "query"

I'm supposed to receive a state parameter with the same value ("development") as I sent. But seems I got a hashing value for it after microsoft received my request:

https://login.microsoftonline.com/xxxxxxxx&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fomniauth%2Fazure_oauth2%2Fcallback&response_type=code&scope=user.read&state=6ff45c77bf433d3bf33dd8df956fda77d62467c0b29b6f4c&sso_reload=true

Any idea? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青衫负雪 2025-02-04 08:08:27

This is working as per design , state will randomly generated unique value is typically used for preventing cross-site request forgery attacks. The state is also used to encode information about the user's state in the app , see the docs for more details - https://learn.microsoft.com/en-us/graph/auth-v2-user
enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文