oauth2.0-授权过程
invalid redirect uri
1 | 包含以下情况 |
Verifying the Authorization Request
verify client id
verify redirect uri
1 | 如果服务端允许APP注册多个redirect uri,那么需要分两步校验。 |
verify response type
verify scope
save state
1 | 保存该值,并将它包含在获取access token的响应中 |
用户登录
1 | 一般,登录成功就相当于授权成功。 |
授权界面
1 | 包含服务端信息(如网站名称、网站logo,便于用户识别),用户身份(如姓名、照片,便于用户知道用那个账号操作),APP信息(APP名称、 |
临时令牌
1 | 下发后,很短时间需过期,推荐10分钟,大多数是30-60秒,长度是任意的,需声明,最好的实现方案是自我包含(避免在数据库中存储临时令牌, |
scope
1 | 主要是为了限制权限,最好是读写分离 |
redirect uri validation
1 | 当开发者新建app注册redirect uri时(不包含fragment); |
请求令牌
redirect_uri
1 | 如果授权请求包含了redirect uri,则token请求必须包含redirect uri |
response
1 | include the additional Cache-Control: no-store and Pragma: no-cache HTTP headers to ensure clients do not cache this request |
令牌生命周期
short-lived access token and long live refresh token
什么情况下使用
1 | 使用自包含access token; |
short-lived access token and no refresh token
什么情况下使用
1 | 最大保证access token泄露风险; |
non-expiring access token
什么情况下使用
1 | 有机制回收access token(如存储在数据库); |