远程服务器返回错误:(401)未经授权。微博的OAuth [英] The remote server returned an error: (401) Unauthorized. Twitter oAuth

查看:6256
本文介绍了远程服务器返回错误:(401)未经授权。微博的OAuth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让工作叽叽喳喳的OAuth与twitterizer,但我不能。

I am trying to make work twitter oAuth with twitterizer, but I am unable.

我收到以下错误:

远程服务器返回错误:(401)未经授权

在我的回调URL是本地主机。

When my callback url is a localhost.

如果我的回调URL是OOB,用于销流能够正常工作。

If my callback url is oob, for the pin flow it works correctly.

下面是我的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);
    }

我从来没有得到令牌时,我设置的回调URL。在Twitter上注册我的回调URL本地主机。

I never get the token when I setup the callback url. On twitter I register my callback url localhost.

我失去了财产以后?

任何想法怎么回事?

推荐答案

请确保您的应用程序设置为在发展门户的Web应用程序。因为在那里有回调地址,请确保您使用的不正确的地址(如应用程序的主页),然后在运行时指定的真实地址。

Make sure your application is set as a web application on the development portal. 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应用程序可以使用基于PIN的认证,但桌面应用程序不能使用网络流量

Web applications can use pin-based authentication, but desktop applications cannot use the web flow.

这篇关于远程服务器返回错误:(401)未经授权。微博的OAuth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆