安卓的AccountManager的authToken和OAuth的 [英] Android AccountManager authToken and OAuth

查看:443
本文介绍了安卓的AccountManager的authToken和OAuth的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的任务是写IMAP电子邮件客户端的Gmail。到目前为止,我知道,客户应通过OAuth的认证(也有一个<一个href="http://$c$c.google.com/p/google-mail-xoauth-tools/source/browse/trunk/java/com/google/$c$c/samples/xoauth/XoauthAuthenticator.java">java库由谷歌IMAP AUTH )。但我想从任何密码输入设置用户免费。

My task is to write IMAP e-mail client for Gmail. So far I know client should authenticate through OAuth (there's also a java library for IMAP auth by Google). But I'd like to set user free from any password typing.

Android提供了一个很酷的原生的方式来获得的authToken通过的AccountManager谷歌帐户的服务。但我不知道怎么用的authToken又是什么呢?难道只为GAE认证?

Android provides a cool 'native' way to gain authToken for google account services via AccountManager. But I wonder how to use authToken and what is it for? Is it only for GAE authentication?

有没有什么办法让oauthToken和oauthTokenSecret没有浏览器(通过的AccountManager)?

Is there any way to get oauthToken and oauthTokenSecret without browser (via AccountManager)?

推荐答案

您是否尝试过使用 oauth2如下:https://mail.google.com/ 为身份验证令牌型( authTokenType 参数)时调用 AccountManager.getAutToken()

Have you tried using "oauth2:https://mail.google.com/" as the "auth token type" (authTokenType parameter) when calling AccountManager.getAutToken() ?

根据什么说的,在<一个46:50 href="http://www.google.com/events/io/2011/sessions/best-practices-for-accessing-google-apis-on-android.html"相对=nofollow>谈谈你提到,它应该工作。

According what is said at 46:50 in the talk you mentioned, it should work.

另外,此页面介绍了如何获得OAuth2令牌谷歌的任务,它有<一个href="http://$c$c.google.com/p/google-api-java-client/source/browse/tasks-android-sample/src/main/java/com/google/api/services/samples/tasks/android/TasksSample.java?repo=samples"相对=nofollow>链接到code样品。这也使得它听起来就像是提供合适的只是一个问题 authTokenType 参数。

By the way, this page describes how to get an OAuth2 token for Google Tasks, and it has a link to a code sample. It also makes it sounds like it is just a matter of providing the right authTokenType parameter.

这篇关于安卓的AccountManager的authToken和OAuth的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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