获取使用的OAuth2凭据与谷歌云端硬盘的应用资账户的Andr​​oid应用程序 [英] Getting OAuth2 credentials for use in an Android application with a Google Drive application-owned account

查看:288
本文介绍了获取使用的OAuth2凭据与谷歌云端硬盘的应用资账户的Andr​​oid应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发展,用户已经请求使用谷歌驱动器作为引导CMS,而他们开发出真正的CMS为应用程序的第二个版本的Andr​​oid应用程序。这意味着他们将要访问的驱动器控制台和编辑文档,然后我们的应用程序将需要检索这些。

I'm developing an Android application where the user has requested to use Google Drive as a bootstrap CMS while they develop a real CMS for the second version of the app. This means they will want to access the Drive console and edit documents in it, and our app will then need to retrieve these.

我已经确定,要做到这一点,最好的方法是使用常规的驱动器帐户是应用程序拥有的,如下所述:

I've determined that the best way to do this is using a regular Drive account that is application-owned, as described here:

<一个href=\"https://developers.google.com/drive/service-accounts#use_regular_google_accounts_as_application-owned_accounts\"相对=nofollow称号=developers.google.com /经常使用谷歌账号的申请资账户>常规使用谷歌账号的申请资账户

这需要我们得到的OAuth2凭据用户。本文上述链接链接到一个次要一篇关于这样做:

This requires us to get OAuth2 credentials for the user. The article linked above links to a secondary article about doing that:

检索和使用OAuth 2.0凭证

在,他们表现出的程序的使用检索的OAuth2凭据的授权code 的。根据驱动器文档,只需做一次。

In it, they show a program for retrieving OAuth2 credentials using an authorization code. According to the drive documentation, it is sufficient to do this once.

我怎么给的登录/密码组合授权code,并且是真正的最简单的方式来获得的OAuth2凭据,一旦我有吗?

How do I get the authorization code given the login/pass combination, and is that really the simplest way to get the OAuth2 credentials once I have?

此外,什么是状态参数做,你怎么设置呢?

Moreover, what does the state parameter do and how do you set it?

推荐答案

您可以通过此处的步骤获得身份验证令牌:

You can get the auth token by following the steps here:

使用OAuth 2.0对Web服务器应用

状态参数描述如下:

<一个href=\"http://stackoverflow.com/questions/7722062/google-oauth2-redirect-uri-with-several-parameters\">google OAuth2和几个参数REDIRECT_URI

和是一间codeD字符串,允许重定向URL国家传递回Web应用程序被用来获取的OAuth2令牌。

and is an encoded string that allows the redirect URL to pass back state to the web app being used to get the OAuth2 token.

这篇关于获取使用的OAuth2凭据与谷歌云端硬盘的应用资账户的Andr​​oid应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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