access token for google cloud print service

﹥>﹥吖頭↗ 提交于 2020-08-02 04:58:09

问题


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.

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.

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.

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


回答1:


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.

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.



来源:https://stackoverflow.com/questions/14851544/access-token-for-google-cloud-print-service

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