OAuth for installed applications with .NET

I'm trying to get OAuth for installed apps to work with my code, with little success actually ...

Here is the code:

        GOAuthRequestFactory factory = new GOAuthRequestFactory("cl", "MyApp");
        factory.ConsumerKey = "anonymous";
        factory.ConsumerSecret = "anonymous";



        // example of performing a query (use OAuthUri or query.OAuthRequestorId)
        Uri calendarUri = new OAuthUri("http://www.google.com/calendar/feeds/default/owncalendars/full", "firstname.lastname", "gmail.com");


        CalendarQuery query = new CalendarQuery();
        query.Uri = calendarUri;

        factory.AccountType = "GOOGLE";
        factory.MethodOverride = true;


        Console.WriteLine("Setting up proxy");
        IWebProxy iProxy = WebRequest.DefaultWebProxy;
        WebProxy myProxy = new WebProxy(iProxy.GetProxy(query.Uri));
        // potentially, setup credentials on the proxy here
        myProxy.Credentials = CredentialCache.DefaultCredentials;
        myProxy.UseDefaultCredentials = true;
        factory.Proxy = myProxy;            

        CalendarService service = new CalendarService("MyApp");
        service.RequestFactory = factory;
        service.Query(query);

      

On the last line, I am getting an exception:

      {"Execution of request failed: http://www.google.com/calendar/feeds/default/owncalendars/full?xoauth_requestor_id=firstname.lastname@gmail.com"}

      

The server returns:

      Token invalid - Invalid AuthSub token.

      

Anyone with an idea?

Actually, I'm not really tied to OAuth, but ClientLogin somehow worked in the morning in the morning because of this ... And yet I feel better when users do not need to provide my application with their credentials.

Your best bet would be - a working example, no matter how simple :)

I read somewhere on the net that .NET with OAuth doesn't work very well with GData 1.4.0.2 (current version) and that it works much better with - experimental - 1.5.0.0, but couldn't find a locatino to download the experimental version : (

Thanks in advance!

+2


a source to share





All Articles