如何使用 AccountManager 为多个服务请求身份验证令牌?

发布于 2024-12-26 02:10:04 字数 522 浏览 3 评论 0原文

是否可以使用 AccountManager 同时为多个服务请求身份验证令牌?

基本上我需要访问 Google Docs API(书面)和电子表格 API(明智)。

我尝试使用空格(“writelywise”)和逗号(“writely,wise”),但似乎两者都不起作用。

从这里(http://code.google.com/p/ google-api-java-client/wiki/Android)我知道对于 OAuth 2.0,您可以使用空格,但 Google Docs API 使用 ClientLogin,并且那里没有提及任何内容。

如果我需要分别为每个服务请求身份验证令牌,最好的方法是什么?每次需要更改服务时是否都需要使令牌失效?

我对电子表格 API 唯一需要的就是能够将电子表格导出为 CSV。我需要的所有其余内容都可以使用 Docs API 完成。

Is it possible to request an auth token using AccountManager for more than one service at the same time?

Basically I need access to both the Google Docs API (writely) and the Spreadsheet API (wise).

I tried with a space ("writely wise") and with a comma ("writely,wise"), but it doesn't seem to work with either.

From here (http://code.google.com/p/google-api-java-client/wiki/Android) I know that for OAuth 2.0 you can use a space, but the Google Docs API uses ClientLogin and nothing is mentioned there.

If I need to request an auth token for each service separately, what is the best way to go about it? Do I need to invalidate the token each time I need to change service?

The only thing that I need from the Spreadsheet API is to be able to export a spreadsheet as CSV. All the rest that I need can be done with the Docs API.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

似梦非梦 2025-01-02 02:10:04

在尝试 Spreadsheet API 时,我想知道同样的问题。
我从 https://github.com/joeledstrom/SpreadsheetTest 开始,并对其进行了调整以适用于 API 客户端版本1.6.0,按照“Picasa Android 示例”中的方法进行操作。分别请求两个服务的令牌并在两个不同的请求工厂中使用它们效果很好。唯一棘手的问题是,现在您还必须处理 getAuthToken 返回的用户请求授权的两个意图。

While experimenting with the Spreadsheet API, I wondered about the same question.
I started from https://github.com/joeledstrom/SpreadsheetTest and adapted it to work with API client version 1.6.0, by following the approach in the "Picasa Android Sample". Requesting the tokens for both services separately and using them in two distinct request factories works fine. The only tricky issue is that now you have to also deal with the two intents for requesting authorization from the user that getAuthToken returns.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文