Tweetsharp授权没有呈现的OAuth令牌 [英] Tweetsharp authorization renders no oauth token

查看:132
本文介绍了Tweetsharp授权没有呈现的OAuth令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现我的asp.net MVC 3应用程序tweetsharp但我遇到的问题。

I am trying to implement tweetsharp in my asp.net mvc 3 application but I am running into issues.

我创建了一个新的Twitter应用程序使用以下设置:

I have created a new twitter application with the following settings:

然后我用提供在其网站上有一些小的改动样本:

I then used the sample provided on their website with a few minor changes:

public ActionResult Twitter()
{
    TwitterService service = new TwitterService("key", "secret");
    OAuthRequestToken requestToken = service.GetRequestToken("http://127.0.0.1:8545/Membership/TwitterOAuth");

    var uri = service.GetAuthorizationUri(requestToken);

    return new RedirectResult(uri.ToString(), false /*permanent*/);
}

public ActionResult TwitterOAuth(string oauth_token, string oauth_verifier)
{
    var requestToken = new OAuthRequestToken { Token = oauth_token };

    TwitterService service = new TwitterService("key", "secret");
    OAuthAccessToken accessToken = service.GetAccessToken(requestToken, oauth_verifier);

    service.AuthenticateWith(accessToken.Token, accessToken.TokenSecret);
    TwitterUser user = service.VerifyCredentials();

    return RedirectToAction("Index", "Home");
}

每当我矮了code我重定向到以下Twitter的网址:<一href=\"https://api.twitter.com/oauth/authorize?oauth_token=\">https://api.twitter.com/oauth/authorize?oauth_token=?

任何人都经历过这个?

Anyone experienced this before?

修改

看来,问题是用的应用方式是设置。由于我没有提供回调URL,应用程序被自动保存为一个客户端,而不是浏览器应用程序。有一次,我增加了一个回调URL的code工作正常。

It appears that issue was with the way the application was setup. Since I did not provide a callback url, the application was automatically saved as a client and not browser application. Once I added a callback url the code worked correctly.

推荐答案

看来,问题是用的应用方式是设置。既然你没有提供回调URL,应用程序被自动保存为一个客户端,而不是浏览器应用程序。一旦你添加了一个回调URL的code工作正常。

It appears that issue was with the way the application was setup. Since you did not provide a callback url, the application was automatically saved as a client and not browser application. Once you added a callback url the code worked correctly.

[从你自己的问题文本]

[From you own question text]

这篇关于Tweetsharp授权没有呈现的OAuth令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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