Question

I'm having real trouble trying to create an authentication context using the instructions here -> http://linqtotwitter.codeplex.com/wikipage?title=Implementing%20OAuth%20for%20ASP.NET%20MVC&referringTitle=Learning%20to%20use%20OAuth

I installed the nuget package for the stable v2.1.11 but in the first block of code the credentialStore and SessionStateCredentialStore are not being resolved, even when I am using LinqToTwitter;

  var auth = new MvcAuthorizer
            {
                CredentialStore = new SessionStateCredentialStore
                {
                    ConsumerKey = ConfigurationManager.AppSettings["consumerKey"],
                    ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"]
                }
            };

His example uses controller actions to authenticate but I just want to create the context in a single method since I am using the API through an application without any need to signing in.

Is there something else I am missing here?

Was it helpful?

Solution

I recently updated documentation for v3.0, where I renamed some items to better reflect their purpose and add more consistency to the library. Here's how that should look in 2.1.11:

var auth = new MvcAuthorizer
{
    CredentialStore = new SessionStateCredentials
    {
        ConsumerKey = ConfigurationManager.AppSettings["consumerKey"],
        ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"]
    }
};

The downloadable source code has a project named LinqToTwitterMvcDemo with an example:

https://linqtotwitter.codeplex.com/SourceControl/latest#LinqToTwitterMvcDemo/Controllers/HomeController.cs

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top