OAuth2用户 - 为什么访问令牌过期? [英] OAuth2 - Why do access tokens expire?

查看:2286
本文介绍了OAuth2用户 - 为什么访问令牌过期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用谷歌API和工作的OAuth2。当客户端授权我的应用我给出了刷新令牌和一个短命访问令牌。现在每一个访问令牌到期时,我可以发表我的刷新令牌谷歌和他们会给我一个新的访问令牌。

I am just getting started working with googles API and Oauth2. When the client authorizes my app I am given a "refresh token" and a short lived "access token". Now every time the access token expires, I can POST my refresh token to google and they will give me a new access token.

我的问题是什么是访问令牌即将过期的目的是什么?为什么不能有只是一个持久的访问令牌,而不是刷新令牌?

My question is what is the purpose of the access token expiring? Why cant there just be a long lasting access token instead of the refresh token?

此外,没有刷新令牌过期?

Also, does the refresh token expire?

有关谷歌的oauth2工作流程的详细信息 - <一个href=\"http://$c$c.google.com/apis/accounts/docs/OAuth2.html\">http://$c$c.google.com/apis/accounts/docs/OAuth2.html

For more info on Google Oauth2 workflow - http://code.google.com/apis/accounts/docs/OAuth2.html

我AP preciate任何对此的思考。

I appreciate any thoughts on this.

感谢

推荐答案

这是非常具体的实现,但总的想法是,让供应商与发行长期刷新令牌短期访问令牌。为什么呢?

This is very much implementation specific, but the general idea is to allow providers to issue short term access tokens with long term refresh tokens. Why?


  • 很多供应商的支持承载令牌,这是非常脆弱的安全性,明智的。通过使他们短暂的,需要刷新,它们限制了时间攻击者可以滥用被盗令牌。

  • 大规模部署不希望执行数据库查找每个API调用,所以不是他们发布自恩codeD访问令牌,该令牌可以通过解密验证。然而,这也意味着没有办法撤销这些令牌所以它们很短的时间发出,必须刷新。

  • 刷新令牌需要客户端身份验证,这使得它更强大。不像上述访问令牌,它通常与一个数据库查找来实现。

这篇关于OAuth2用户 - 为什么访问令牌过期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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