I use LINQ to Twitter for authentication in my MVC application on localhost.
我在localhost的MVC应用程序中使用LINQ to Twitter进行身份验证。
I configured my twitter app in the following way:
我将我的twitter应用配置为:
I implemented the controller using this article: https://linqtotwitter.codeplex.com/wikipage?title=Implementing%20OAuth%20for%20ASP.NET%20MVC&referringTitle=Learning%20to%20use%20OAuth and my methods BeginAsync and CompleteAsync are completely the same as in the article. But I keep getting an error 'XMLHttpRequest cannot load https://api.twitter.com/oauth/authorize?oauth_token=<myToken>. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1' is therefore not allowed access. '
我使用本文实现了控制器:https://linqtotwitter.codeplex.com/wikipage?但我不断收到一个错误“XMLHttpRequest无法加载https://api.twitter.com/oauth/authorize?oauth_token=
I added in Web.config:
我在web . config中添加:
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
...
</system.webServer>
but it is still not working.
但它仍不奏效。
Any thoughts?
任何想法吗?
1
I think that the guy from the article didn't use ajax requests. The twitter oauth api doesn't support CORS.
我认为这篇文章的作者没有使用ajax请求。twitter oauth api不支持CORS。
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2014/11/19/4dda20c24c631f5d3e7f9a62189ba8f1.html。