简体   繁体   English

远程服务器返回错误:(401) Unauthorized。 Twitter oAuth

[英]The remote server returned an error: (401) Unauthorized. Twitter oAuth

I am trying to make work twitter oAuth with twitterizer, but I am unable.我正在尝试使用 twitterizer 完成 twitter oAuth 工作,但我做不到。

I am getting the following error:我收到以下错误:

The remote server returned an error: (401) Unauthorized . The remote server returned an error: (401) Unauthorized

When my callback url is a localhost.当我的回调 url 是本地主机时。

If my callback url is oob, for the pin flow it works correctly.如果我的回调 url 是 oob,则对于引脚流,它可以正常工作。

Here is my code:这是我的代码:

 public ActionResult LogOn(string returnUrl, bool? perm)
    {
        string consumerKeyTw = @"UF3F72XqfGShQs7juKMApA";
        string consumerSecretTW = "secret";
        OAuthTokenResponse requestToken = OAuthUtility.GetRequestToken(consumerKeyTw, consumerSecretTW, "http://localhost:58892/Twitterr/OAuth");

        // Direct or instruct the user to the following address:
        Uri authorizationUri = OAuthUtility.BuildAuthorizationUri(requestToken.Token);

        return new RedirectResult(authorizationUri.ToString(), false);
    }

I never get the token when I setup the callback url.当我设置回调 url 时,我从来没有得到令牌。 On twitter I register my callback url localhost.在 twitter 上,我注册了我的回调 url localhost。

Am I missing somthing?我错过了什么吗?

Any idea whats going on?知道发生了什么吗?

Make sure your application is set as a web application on the development portal .确保您的应用程序在开发门户上设置为 web 应用程序。 For the callback address there, make sure you use an incorrect address (like your application's homepage), then specify the real address at runtime.对于那里的回调地址,请确保您使用了不正确的地址(例如应用程序的主页),然后在运行时指定真实地址。

Web applications can use pin-based authentication, but desktop applications cannot use the web flow. Web 应用程序可以使用基于 pin 的身份验证,但桌面应用程序不能使用 web 流程。

I had this same problem and fixed it by adding a "Callback URL" in the Twitter App Settings page.我遇到了同样的问题,并通过在 Twitter 应用程序设置页面中添加“回调 URL”来修复它。 I didn't have my domain name yet so I simply added a unused domain name like: http://www.website.com .我还没有我的域名,所以我只是添加了一个未使用的域名,例如: http://www.website.com The Twitterizer request call immediatly started working for me. Twitterizer 请求调用立即开始为我工作。

Fissh

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 远程服务器返回错误:(401)未经授权。 wcf httpbinding基本 - The remote server returned an error: (401) Unauthorized. wcf httpbinding basic 出现错误:远程服务器返回错误:(401)未经授权。 ,同时将我的网站评论发布到Twitter。 使用C# - Getting error : The remote server returned an error: (401) Unauthorized. , while posting my website comments to twitter. Using C# C#JIRA工作日志更新错误“远程服务器返回错误:(401)未经授权。” - C# JIRA work-log update error “The remote server returned an error: (401) Unauthorized.” System.Net.WebException:远程服务器返回错误:(401)未经授权。 在System.Net.HttpWebRequest.GetResponse() - System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() SharePoint 仅应用程序身份验证抛出“远程服务器返回错误:(401)未经授权。” - SharePoint App-Only Authentication throwing “The remote server returned an error: (401) Unauthorized.” 远程服务器返回错误:(401) 未经授权。 在 Visa 开发支付网关 - The remote server returned an error: (401) Unauthorized. In Visa develope payment Gateway 为什么我收到“远程服务器返回错误:(401) 未经授权”。 从这个代码片段? - Why am I getting 'The remote server returned an error: (401) Unauthorized.' from this code snippet? Twitter API集成-远程服务器返回错误:(401)未经授权 - Twitter API Integration - The remote server returned an error: (401) Unauthorized Twitter搜索API远程服务器返回错误:(401)未经授权 - Twitter Search API The remote server returned an error: (401) Unauthorized EWS:“远程服务器返回错误(401)未经授权” - EWS: “The remote server returned error (401) Unauthorized”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM