Google Drive API用户名+密码认证 [英] Google Drive API username + password authentication

查看:714
本文介绍了Google Drive API用户名+密码认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程式,让Google Drive用来管理一些文件。我们的想法是创建一个包含一些初始模板数据的文​​档,并通过将它们添加为文档的协作者来为用户提供访问权。



我熟悉OAuth身份验证过程,我用它在系统的另一部分管理用户Calendar ...



但在这种情况下,这些文档将存储在公司的通用帐户中,所以我不能有批准提示进行身份验证,因为用户不会有帐户的密码。



我想直接在此帐户中进行身份验证,可能是在Java代码中硬编码的用户名和密码。



问题是这种验证方法被取消,我没有找到重新定位。



有什么想法?

在此先感谢您,
Phillip

解决方案

有两种方法可以想到:


  1. 服务帐户:最适合传统后端的服务器端OAuth
  2. 应用程序拥有的常规账户:与您已经熟悉的客户端Oauth已有的流程类似; Auth,存储刷新,如果AuthCode过期,则询问新的令牌。等等。

我个人喜欢第二种解决方案更多,因为我觉得在将来Oauth客户端更灵活地适应令牌并将其用于服务器端。

I'm developing an application where Google Drive will be used to manage some documents. The idea is to create a document with some initial template data and provide the users access by adding them as collaborators of the document.

I'm familiar with the OAuth authentication process, I used it in another part of the system to manage the users Calendar...

But in this case these documents will be stored in a generic account of the company, so I can't have the approval prompt for authentication, since users won't have the password of the account.

I'd like to directly authenticate in this account, could be with the username and password hardcoded in the Java code.

Problem that this method of authentication was depreacated and I didn't found a relpacement.

Any ideas?

Thanks in advance, Phillip

解决方案

There are 2 ways that comes to mind:

  1. Service accounts: best suited for server side OAuth with traditional backend
  2. Regular Account owned by the application : similar to the process already in place for client side Oauth that you are already familiar with; Auth, store the refresh, ask new token if the AuthCode is expired, and so on.

I personally use and prefer the second solution more as I feel is more flexible to adapt in the future for Oauth Client Side get the tokens and use them server side.

这篇关于Google Drive API用户名+密码认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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