远程服务器返回错误:(401)未经授权。微博的OAuth

编程入门 行业动态 更新时间:2024-10-26 21:31:33
本文介绍了远程服务器返回错误:(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, "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

本文发布于:2023-11-09 22:42:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1573633.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:未经授权   错误   服务器   OAuth

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!