谷歌云打印服务访问令牌 [英] access token for google cloud print service

查看:134
本文介绍了谷歌云打印服务访问令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的应用程序使用谷歌云打印服务, 概念是:买家可以从我的网站购买产品,他应该将订单列表发送给供应商的打印机.

I want to use google cloud print service for my application, Concept is : Buyer can purchase products from my site and he should send order list to supplier's printer.

为此,供应商应在其Google帐户中注册打印机,买方将向选定的供应商的打印机发送打印请求,订单文件应在供应商的打印机上打印.

For this, Supplier should registor printer in their google account, buyer will send print request to selected supplier's printer, and order document should be printed on supplier's printer.

问题是:云打印应用程序正在使用OAuth2身份验证,它需要Google帐户登录名和client_id来获取访问令牌.因此,要获取打印机列表和提交打印作业,买方需要使用后端提供的供应商的Google凭据从google帐户登录. (使用或不使用浏览器)这是不可接受的,因为它还将允许买方使用供应商帐户的其他Google服务(例如,邮件,文档).

Problem is : Cloud print application is using OAuth2 autherization and it requries google account login and client_id to obtain access token. So for geting list of printers and submiting print job, buyer needs to login from google account with the supplier's google credentials from backend. (With or without browser) That's not acceptable as it will also allow buyer to use other google services (e.g. mail,docs) of supplier's account.

所以我的问题是,还有其他获取访问令牌的方法吗? 也欢迎任何其他解决方案.

So my question is , Is there any other method to get access token? Any other solution is also welcome.

注意:我已经从 google-pythonCode cloudprinting 模块.

Note: I have taken reference from google-pythonCode and cloudprinting module.

推荐答案

您要做的是让供应商使用OAuth2进行授权,并存储其access_token和更重要的refresh_token.买家根本不需要与Google进行授权,您只需将其打印作业发送给具有相应供应商访问令牌的供应商打印机即可.由于每个供应商的Google帐户已经可以访问自己的打印机,因此这也使处理不同打印机的访问更加容易.

What you want to do is to have the suppliers authorize with OAuth2 and store their access_token and more importantly refresh_token. The buyers do not need to authorize with Google at all, you can simply send their print job to the suppliers printer with the appropriate suppliers access token. This also makes it easier to handle the access to the different printers as each suppliers Google account already has access to their own printer.

刷新令牌是有效期很长的令牌(有效期直到被供应商吊销为止),即使在短暂(1小时)访问令牌到期后,刷新令牌也可以使您获得新的访问令牌.

The refresh token is a long living token (valid until revoked by supplier) that allows you to get new access tokens even after the expiration of the short lived (1 hour) access token.

这篇关于谷歌云打印服务访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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