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 6102095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:34:29+00:00 2026-05-23T13:34:29+00:00

I get the error com.google.gdata.util.AuthenticationException: Unknown authorization header at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:600) ~[gdata-core-1.0.jar:na] at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:563) ~[gdata-core-1.0.jar:na]

  • 0

I get the error

com.google.gdata.util.AuthenticationException: Unknown authorization header
     at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:600) ~[gdata-core-1.0.jar:na]
     at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:563) ~[gdata-core-1.0.jar:na]
     at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:552) ~[gdata-core-1.0.jar:na]
     at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:530) ~[gdata-core-1.0.jar:na]
     at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535) ~[gdata-core-1.0.jar:na]

when trying to access the Google Calendar data via their API.

Here is what happens before that error.

1) I authenticate with Google:

final AccessTokenResponse response =
          new GoogleAuthorizationCodeGrant(httpTransport,
                    jsonFactory,
                    clientId, clientSecret, authorizationCode,
                    redirectUrl).execute();

final GoogleAccessProtectedResource accessProtectedResource =
          new GoogleAccessProtectedResource(
                    response.accessToken, httpTransport, jsonFactory,
                    clientId, clientSecret,
                    response.refreshToken);

LOGGER.debug("response.accessToken: {}", response.accessToken);

this.oauthAccessToken = response.accessToken;

...

2) I read some data via the tasks API:

    this.service =
            new Tasks(httpTransport, accessProtectedResource,
                    jsonFactory);
    this.service.setApplicationName(this.applicationName);

This seems to work.

3) Then I try to read data from the Google Calendar API:

    final OAuthHmacSha1Signer signer = new OAuthHmacSha1Signer();

    final GoogleOAuthParameters  oauth = new GoogleOAuthParameters ();

    oauth.setOAuthConsumerKey("myapp.com");
    oauth.setOAuthConsumerSecret(CLIENT_SECRET); // Client secret from "Google API access" page, "Client secret" entry
    oauth.setOAuthToken(this.oauthAccessToken); // Access token from step 1
    oauth.setOAuthTokenSecret(aAuthorizationCode); 
    // aAuthorizationCode is taken from the callback URL.
    // For http://myapp.com/oauth2callback?code=4/uy8Arb4bhRPwWYSr3QwKPt9lIZkt
    // aAuthorizationCode is equal to "4/uy8Arb4bhRPwWYSr3QwKPt9lIZkt" (without quotes)

    oauth.setScope(SCOPE_CALENDAR); // https://www.google.com/calendar/feeds/

    final CalendarService calendarService =
            new CalendarService(APPLICATION_NAME);

    calendarService
            .setOAuthCredentials(oauth, signer);


    LOGGER.debug("calendarService: {}", calendarService);

    final URL feedUrl =
            new URL(
                    "http://www.google.com/calendar/feeds/default/allcalendars/full");
    final CalendarFeed resultFeed =
            calendarService.getFeed(feedUrl, CalendarFeed.class);

At the last line (calendarService.getFeed…) the aforementioned exception occurs.

I have following questions:

1) Is my call

oauth.setOAuthConsumerKey

correct?

I. e. is the “consumer key” equal to “Product name” in the Google API console, or to “Client ID” field (value is something like 42912397129473.apps.googleusercontent.com)

2) Is the setOAuthTokenSecret correct? I. e. is it the code that I get, when Google redirects the user back to my app?

3) If questions 2 and 3 were answered with yes, what else can be the cause of my problem?

Thanks

Dmitri

P. S.: Previously, I could access Google calendar with simple access (i. e. with Google user name and password). However, this is not an option now because users of my app will not want to give away their Google password.

  • 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-05-23T13:34:30+00:00Added an answer on May 23, 2026 at 1:34 pm

    Finally, I solved my problem by following the example at

    http://code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/oauth/OAuthExample.java

    My advice to all future victims^W users of OAuth: Pay attention to the smallest details in the OAuth tutorials. The OAuth devil lies in details.

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

Sidebar

Related Questions

Since Days i'm trying to parse a YOUTUBE-XML-Feed by using GDATA-API for iOS. http://code.google.com/intl/de-DE/apis/youtube/2.0/developers_guide_protocol_channel_search.html
Google analytics posted on their blog about an example Java program to extract data
I just installed Eclipse Helios (Java EE edition) and tried to install the Google
I'm parsing JSON using GSON, but get an error when I try to parse
I am trying to learn how to use the Google Spreadsheets API through the
I am trying to post a request to the google authSub for youtube. I
I'm following the MapView tutorial on the Android website [2010-08-22 11:12:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestParser] Parser
I'm currently working with the Google Picasa API trying to list albums. The code
I'm trying to use Google's OAuth in my system. I've successfully integrated Twitter and
I am trying to upload the document using Google API through my iPhone App.

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.