Google Cloud Print: How long is the token good for (to submit jobs to cloud print)?

梦想与她 提交于 2019-12-10 19:53:39

问题


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?

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.)

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.)

Thanks!


回答1:


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.

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.

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



来源:https://stackoverflow.com/questions/15538143/google-cloud-print-how-long-is-the-token-good-for-to-submit-jobs-to-cloud-prin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!