How to Access Google Docs via GData API

I’m currently using ASP.NET 4.0 C# (Framework Agnostic) and relying on Google GData for my project. I’ve set up two pages: Auth and List. In the Auth page, I’m redirecting to the Google server for authentication as follows:

public ActionResult Auth()
{
    var redirectUrl = Request.Url.ToString().ToLowerInvariant().Replace("auth", "list");
    var scopeUrl = "https://docs.google.com/feeds/";
    bool isSecure = false, useSession = true;

    var authUrl = AuthSubUtil.getRequestUrl(redirectUrl, scopeUrl, isSecure, useSession);
    return new RedirectResult(authUrl);
}

Upon successful authentication, it navigates to the List page:

public ActionResult List()
{
    if (Request.QueryString["token"] != null)
    {
        string authToken = Request.QueryString["token"];  
        string appKey = "www.blahblah.net";
        string appSecret = "my_key";
        string sessionAuthToken = AuthSubUtil.exchangeForSessionToken(authToken, null).ToString(); 

        var requestFactory = new GOAuthRequestFactory("writely", "qwd-asd-01");
        requestFactory.Token = sessionAuthToken;
        requestFactory.ConsumerKey = appKey;
        requestFactory.ConsumerSecret = appSecret;

        try
        {
            var documentService = new DocumentsService(requestFactory.ApplicationName) { RequestFactory = requestFactory };

            var documentQuery = new DocumentsListQuery();
            documentQuery.Title = "project";

            var documentFeed = documentService.Query(documentQuery);
            var documentTitles = documentFeed.Entries.ToList().ConvertAll(entry => entry.Title.Text);
            return View(documentTitles);
        }
        catch (GDataRequestException)
        {
            throw;
        }
    }
}

This fails on the line that attempts to query for documents with the error:

Execution of request failed: https://docs.google.com/feeds/default/private/full?title=project

The catch block shows that the HttpStatusCode is HttpStatusCode.Unauthorized. What could be going wrong in this code? Is obtaining a TokenSecret necessary, and if so, how can I acquire it?

It seems like the issue could be related to the authentication or authorization process with Google servers. One potential cause is that the OAuth 1.0 authentication method you’re using might be outdated. Google often updates its APIs, and GData might not support the current security standards. Instead, consider using Google’s OAuth 2.0 libraries, which are more secure and easier to integrate.

Do check whether the client id and secret have proper access rights to get the list of documents, and whether any additional scope is needed. It may also be worthwhile to verify that the client credentials are correctly configured in the Google Developer Console.