Using Android AccountManager to get authtoken for gdata

So, I'm trying to sync with google docs without asking the user for their credentials. I use this code to get the authentication token:

AccountManager mgr = AccountManager.get(activity);
authToken = mgr.blockingGetAuthToken(account, DocsService.DOCS_SERVICE, true);

This returns an authentication tag that looks well formed. So, on my DocsService, I run:

service.setAuthSubToken(authToken);

However, when I try to use the API, I just get an authentication exception. Any ideas on how to approach this error?

edit: I have permission USE_CREDENTIALS.

+3
source share
3 answers

, ClientLogin, AuthSub. , GData Java Client Android. GData Java Client, Android Google API Java.

, API Google Java: calendar-v2-atom-android-sample docs-v3-atom-oauth-sample

: Java GData API Google API Java.

+6

, Gdata Lib Android. - . , Google - (Android).

, Android. Google Code- http://code.google.com/p/google-spreadsheet-lib-android/

.

0

Source: https://habr.com/ru/post/1766714/


All Articles