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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:07:57+00:00 2026-06-17T18:07:57+00:00

I’ve been tinkering for a while now with getting the Google Calendar API working

  • 0

I’ve been tinkering for a while now with getting the Google Calendar API working with DotNetOpenAuth. I’ve tried going about it in a few different ways, and I keep running up against the following error:

The remote server returned an error: (401) Unauthorized.

I’ve tried it both by using the CalendarService in the Google Data API for .NET, and by adapting the Google Contacts sample in the DotNetOpenAuth samples project.

When I tried using the CalendarService, I set up my service for authentication by setting the authentication token like so:

_service = new CalendarService("CalendarSampleApp");
_service.SetAuthenticationToken(accessToken);

When reworking the Google Contacts sample, I simply changed the endpoint to reflect the Google Calendar endpoint instead of the Google Contacts endpoint, like so:

private static readonly MessageReceivingEndpoint GetCalendarEndpoint = new MessageReceivingEndpoint("http://www.google.com/calendar/feeds/default/private/full", HttpDeliveryMethods.GetRequest);

public static XDocument GetCalendarEntries(ConsumerBase consumer, string accessToken, int maxResults/* = 25*/, int startIndex/* = 1*/)
{
    if (consumer == null)
    {
        throw new ArgumentNullException("consumer");
    }

    var extraData = new Dictionary<string, string>() {
        { "start-index", startIndex.ToString(CultureInfo.InvariantCulture) },
        { "max-results", maxResults.ToString(CultureInfo.InvariantCulture) },
    };
    var request = consumer.PrepareAuthorizedRequest(GetCalendarEndpoint, accessToken, extraData);

    // Enable gzip compression.  Google only compresses the response for recognized user agent headers. - Mike Lim
    request.AutomaticDecompression = DecompressionMethods.GZip;
    request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.151 Safari/534.16";

    var response = consumer.Channel.WebRequestHandler.GetResponse(request);
    string body = response.GetResponseReader().ReadToEnd();
    XDocument result = XDocument.Parse(body);
    return result;
}

When I run this, here’s the request that gets sent:

http://www.google.com/calendar/feeds/default/private/full?oauth_token=1/kyuMER6kPiG13pOw5M4NoEE7AJdN2fE4jTKSgaMToT8&oauth_consumer_key=419892106817-obg9lu9j9ihpnlh2e2qa01ber4hmq5mh.apps.googleusercontent.com&oauth_nonce=NtfQzRV3&oauth_signature_method=HMAC-SHA1&oauth_signature=XEdf4ipECY2iBfdQfupD1IK1uFw%3D&oauth_version=1.0&oauth_timestamp=1358213228&start-index=1&max-results=5&gsessionid=TV7D3zHTc7T3l41Xqfn-ig

As I said, in either of these cases, I’m getting the same 401 error. Does anyone have any ideas on what I am doing wrong, or how to troubleshoot further?

  • 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-17T18:07:59+00:00Added an answer on June 17, 2026 at 6:07 pm

    I think you are working with an old version of the library.
    Please download the latest stable release from:
    https://code.google.com/p/google-api-dotnet-client/wiki/Downloads

    And you should also consider reading OAuth2’s documentation:
    https://code.google.com/p/google-api-dotnet-client/wiki/OAuth2

    Hope it may help,
    Eyal

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have been unable to fix a problem with Java Unicode and encoding. The
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

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.