Google云端打印:令牌对(将作业提交到云端打印)有多长时间? [英] Google Cloud Print: How long is the token good for (to submit jobs to cloud print)?

查看:90
本文介绍了Google云端打印:令牌对(将作业提交到云端打印)有多长时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我的用户使用oauth v2进行云打印以获取证书,我如何获得至少48小时有效的证书?

If my user uses oauth v2 to cloud print to get a credential, how do I get a credential that is good for at least 48 hours?

能够访问打印机,并将其保留几天。 (可以想象,我们可能会要求用户每周一次或两次向Google重新验证,但肯定不会更多。)

We need to be able to get access to the printer, and keep it for some days. (Conceivably we could require the user to re auth to google once or twice a week, but certainly not more.)

如果Google云打印无法做到这一点,该怎么办?系统可以吗? (需要跨平台打印,从云到Win,osx和linux,还需要能够对本地打印机进行原始打印,而不仅仅是打印驱动程序打印。)

If google cloud print can't do this, what system can? (Require cross platform printing, from cloud to win, osx and linux, also require ability to do raw printing to local printer, not just print driver printing.)

谢谢!

推荐答案

OAuth2流程中有两种凭证:访问令牌(其生存期为简短,由OAuth2服务器响应的 expires_in 字段)和刷新令牌决定,除非用户撤销授予的访问权限,否则该令牌实际上是永久的。当您拥有刷新令牌时,您可以获得有效的访问令牌。

There are two types of "credentials" in OAuth2 process: access token (its lifetime is short and determined by expires_in field of the OAuth2 server response) and refresh token which is virtually permanent unless user revokes granted access. When you possess refresh token you can get valid access token.

在首次身份验证请求时,使用参数 access_type = offline 返回刷新令牌。您需要做的就是安全地存储获取的刷新令牌,并在必要时使用它来请求访问令牌。

Refresh token is returned upon first auth request with parameter access_type=offline. All you need is to store obtained refresh token securely and use it to request for access token when necessary.

在文档中了解更多信息
https://developers.google.com/accounts/docs/OAuth2WebServer

Read more in the document https://developers.google.com/accounts/docs/OAuth2WebServer

这篇关于Google云端打印:令牌对(将作业提交到云端打印)有多长时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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