OAuth 2.0的“代码"生命周期在授权码授予中 [英] OAuth 2.0 Life cycle of "code" in Authorization code Grant

查看:269
本文介绍了OAuth 2.0的“代码"生命周期在授权码授予中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

授权代码Grant:我知道代码是短暂的令牌,交换为真正的长期访问令牌.我已经查看过 Oauth 2.0 ,但是找不到此信息,因此询问在这里:

Authorization code Grant : I know the code is short lived token exchanged for the real long-lived access token. I have gone through the Oauth 2.0 but could not find this information so asking here:

  • 代码的生命周期是什么?
  • 仅一次使用吗?
  • 可以交换几次代码以获得访问令牌?
  • 为代码赋予访问令牌后,该代码会发生什么?

我在Kong API网关上使用 oAuth 2.0插件.它将代码保留特定时间,并且可以在同一时间使用相同代码生成多路访问令牌. 这是预期的行为吗?

I am using oAuth 2.0 plugin on Kong API gateway. it is keeping the code alive for a particular time and multiple access token can be generated using same code by that time. Is it the expected behaviour?

谢谢您的建议.

推荐答案

授权码必须短暂存在,并且应一次性使用,以免出现虚假使用.因此,回答您的问题

Authorization Code must be short lived and should be one time use to avoid fake use. So to answer your questions

代码的生命周期是什么?

  • 当用户使用 授权代码 进行身份验证时,一旦对范围进行了身份验证并被授予访问权限,就会创建一个短暂的(例如1分钟)有效代码,并将其发送回重定向uri.

仅一次使用吗?

  • 是的,它必须一次性使用以获得最佳安全性,当使用authorication_code请求访问令牌时,请求成功或失败(由于某些验证错误或服务器错误),必须删除授权代码或将其标记为用过的(取决于您要使用的方式)

可以交换几次代码以获得访问令牌?

  • 一个authorization_code只能授予一个访问令牌,因为一旦发出访问令牌,该代码就会被撤消.

为该代码提供访问令牌后,该代码会发生什么?

最佳做法是,可以删除代码

Best practice, the code can be deleted

请查阅google oauth2.0文档以更好地了解并了解其用途.

Check out google oauth2.0 documentations for better understanding and see how its used.

https://developers.google.com/identity/protocols/OAuth2WebServer

对于Kong问题,似乎是kong的一个错误,他们承诺将在0.9版本中修复. 检查此讨论.

For Kong issue it seems its a bug in kong and they promised to give fix in 0.9 release. Check this discussion.

这篇关于OAuth 2.0的“代码"生命周期在授权码授予中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆