【发布时间】:2020-12-05 15:10:11
【问题描述】:
我对授权码授予流程有一些疑问。
我知道 oauth2 的第一部分是发送 https://auth.server/oauth2/auth?scope= &redirect_uri=https://app.example.com/oauth2/callback &response_type=code&client_id=123 &state=af0ifjsldkj
我对 state 参数感到困惑。我了解 state 参数是为了防止 csrf 的攻击。但是我应该在哪里保存这个参数?如果我将它保存到身份验证服务器的会话中,我如何在以下步骤中验证状态?
https://app.example.com/oauth2/callback?
code=MsCeLvIaQm6bTrgtp7&state=af0ifjsldkj
如何验证 app.example.com 中的 state 参数,但 state 参数保存在 auth server 的 session 中?
【问题讨论】:
标签: oauth-2.0 authorization csrf csrf-token