2

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?

4

1 回答 1

1

我最近更新了 v3.0 的文档,我重命名了一些项目以更好地反映它们的用途并为库增加更多的一致性。这是 2.1.11 中的样子:

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

可下载的源代码有一个名为 LinqToTwitterMvcDemo 的项目,其中包含一个示例:

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

于 2014-01-22T18:17:49.353 回答