【问题标题】:Understanding the authorization flow with Google Drive and Google Play Services了解 Google Drive 和 Google Play Services 的授权流程
【发布时间】:2013-03-21 06:13:08
【问题描述】:

我已经完成了 Google Drive 的快速入门,并且还使用了 Google Play 服务。 Google Drive 的文档概述了授权流程的工作流程。文档还指出开发人员不应使用 Drive 启动的授权,尽管 Quickstart 示例应用程序似乎正是这样做的。我的印象是 Google 更喜欢开发者处理授权的所有细节。

然而,在尝试了使用 Google Play 服务(但不是用于 Google Drive)的示例代码之后,我留下的印象是 Google 希望开发人员使用 Google Play 服务来处理所有授权。 Google Play 服务似乎大大简化了授权过程。虽然文档没有这么说,但我在网上的其他地方发现 GoogleAuthUtil.getToken 管理如何检索访问和刷新令牌,尤其是在它们过期之后。

基本上,我难以理解的问题是 API 的 Google Drive 文档是否已过时,而 Google 希望我们依赖 Google Play 服务。 Google Play 服务已经消除了 Google Drive 授权过程的复杂性。同时,Google Drive API 的文档已经发布了半年多,这让我怀疑为什么 Google 没有更新这些文档以反映 Google Play 服务是如何与它一起使用的。

任何对此的见解将不胜感激。

【问题讨论】:

    标签: google-drive-api google-play-services


    【解决方案1】:

    在 Android 上推荐的授权方法是使用 Google Play 服务。 Google Drive SDK 文档上的 Android 快速入门指南涵盖了以下内容:

    https://developers.google.com/drive/quickstart-android

    【讨论】:

    • 它根本没有涵盖这一点。如果您阅读文档,您所知道的有关 Google Play 服务的全部内容就是安装它。除此之外,关于如何集成 Google Play 服务的提及为零。事实上,根本没有提到 Google Play 服务处理所有令牌管理。 Google Drive 文档非常缺乏。
    【解决方案2】:

    Google 云端硬盘文档已过时,Google 确实应该更新它们。检索令牌和验证用户应使用 Google Play 服务完成。您唯一应该使用 Google Drive API 的就是访问 Google Drive 服务。 Google Play 服务处理验证用户、检索访问和刷新令牌以及处理所有可能出现的错误的所有细节。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-17
      • 2016-11-21
      • 2015-12-26
      • 1970-01-01
      • 2016-11-18
      • 2017-07-10
      • 1970-01-01
      • 2013-09-06
      相关资源
      最近更新 更多