views:

85

answers:

1

So I am trying to sync to google docs, without having to ask the user for his credentials. I use this code to get an auth-token:

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

This returns a auth-token that looks well-formated. So on my DocsService I run:

service.setAuthSubToken(authToken);

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

edit: I do have the USE_CREDENTIALS permission.

+1  A: 

The problem is that the returned token is a ClientLogin token, not an AuthSub token. An even bigger problem is that the GData Java Client library does not officially support Android. We recently added a note on the home page of the GData Java Client library that for Android we recommend Google API Client Library for Java instead.

Two samples come up mind that would be helpful for you for getting started with Google API Client Library for Java: calendar-v2-atom-android-sample and docs-v3-atom-oauth-sample

Disclosure: I am an owner of both the GData Java Client library and Google API Client Library for Java projects.

Yaniv Inbar