Android AccountManager authToken and OAuth

允我心安 提交于 2019-12-09 06:17:47

问题


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 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?

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


回答1:


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

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

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.



来源:https://stackoverflow.com/questions/6649388/android-accountmanager-authtoken-and-oauth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!