Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8550027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:51:26+00:00 2026-06-11T13:51:26+00:00

Hi I’m working on project, which has to access Google Docs. As example I’ve

  • 0

Hi I’m working on project, which has to access Google Docs. As example I’ve started from here
Currently I’m getting “401 Cannot parse AuthSub token”
I’ve looked into:

https://developers.google.com/google-apps/documents-list/

http://code.google.com/p/google-api-java-client/

Using Android AccountManager to get authtoken for gdata

And as I understand, android returns wrong type of access token. If there are any way to create valid access token for android using AccountManager, or I need to uses some other way of authentication?

import com.google.api.client.googleapis.extensions.android.accounts.GoogleAccountManager;
import com.google.api.services.docs.DocsClient;
import com.google.api.services.docs.DocsUrl;
import com.google.api.services.docs.model.DocumentListEntry;
import com.google.api.services.docs.model.DocumentListFeed;

public class Main extends ListActivity{
    private static final String AUTH_TOKEN_TYPE = "writely";
    private static final HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
    protected DocsClient client;
    String accountName;


    GoogleAccountManager accountManager;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        client = new DocsClient(HTTP_TRANSPORT.createRequestFactory(credential));
        accountManager = new GoogleAccountManager(this);
        gotAccount();
    }

    void gotAccount() {

        accountManager.getAccountManager().getAuthToken(account, AUTH_TOKEN_TYPE, true, new AccountManagerCallback<Bundle>() {

          public void run(AccountManagerFuture<Bundle> future) {
            try {
              Bundle bundle = future.getResult();
              if (bundle.containsKey(AccountManager.KEY_INTENT)) {
                Intent intent = bundle.getParcelable(AccountManager.KEY_INTENT);
                intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivityForResult(intent, REQUEST_AUTHENTICATE);
              } else if (bundle.containsKey(AccountManager.KEY_AUTHTOKEN)) {
                setAuthToken(bundle.getString(AccountManager.KEY_AUTHTOKEN));
                onAuthToken();
              }
            } catch (Exception e) {
              Log.e(TAG, e.getMessage(), e);
            }
          }
        }, null);
  }

void setAuthToken(String authToken) {
    credential.setAccessToken(authToken);
  }

 void onAuthToken() {
    List<String> result = new ArrayList<String>();
    DocumentListFeed feed = client.executeGetDocumentListFeed(DocsUrl.forDefaultPrivateFull());
    for (DocumentListEntry doc : feed.docs) {
            result.add(doc.title);
          }
    //DO something with list
  }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:51:28+00:00Added an answer on June 11, 2026 at 1:51 pm

    I’ve succeed in implementing this task. Had to switch to version 1.7 of google api client and uses

    com.google.api.client.googleapis.auth.clientlogin.ClientLogin.Response

    instead of

    com.google.api.client.googleapis.auth.oauth2.GoogleCredential

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've a project that I'm working on which has not been started by me.
I started working on a project which uses Net_URL_Mapper from PEAR (php) as the
I am currently working on a project which has Employee, Manager entities. At the
I'm currently working on a project which uses many ajax requests to access data
I'm currently working on a project in which access to an API is restricted
Can anyone help me find an up-to-date, working ATL project which has a main
I have a project which I am working on and it has multiple files
I have a project which I am working on and it has multiple files
I've just finished working for a client which has burnt millions on a project
I'm working on a project which has been successfully deployed to a local instance

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.