我需要实现Twitter的API应用程序唯一的身份验证,我已经通过linq2twitter OAuth的样品以及StackOverflow的问题,但我没有发现任何关于它的帮助。
I need to implement Twitter API application-only authentication and I've searched through linq2twitter oauth samples and stackoverflow questions, but I didn't find anything helpful about it.
是否有可能实现这种与linq2twitter如何授权?
Is it possible to implement this kind of authorization with linq2twitter and how?
推荐答案当然是。这里有一个例子:
Sure is. Here's an example:
var auth = new ApplicationOnlyAuthorizer { Credentials = new InMemoryCredentials { ConsumerKey = "twitterConsumerKey", ConsumerSecret = "twitterConsumerSecret" } }; auth.Authorize(); //auth.Invalidate(); var twitterCtx = new TwitterContext(auth); var srch = (from search in twitterCtx.Search where search.Type == SearchType.Search && search.Query == "LINQ to Twitter" select search) .SingleOrDefault(); Console.WriteLine("\nQuery: {0}\n", srch.SearchMetaData.Query); srch.Statuses.ForEach(entry => Console.WriteLine( "ID: {0, -15}, Source: {1}\nContent: {2}\n", entry.StatusID, entry.Source, entry.Text));有在下载的源$ C $ C的LinqToTwitterDemo项目运行的例子。 Program.cs文件具有唯一的应用程序的选项。还有,有一个例子的OAuthDemos.cs文件
There are running examples in the LinqToTwitterDemo project of the downloadable source code. The Program.cs file has an option for Application Only. There's also an OAuthDemos.cs file that has an example.
更多推荐
Twitter的API应用程序的唯一身份验证(带linq2twitter)
发布评论