加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows-phone-7 – 不使用pin的Twitter身份验证

发布时间:2020-12-14 02:45:23 所属栏目:Windows 来源:网络整理
导读:我正在尝试在 Windows Phone中验证用户帐户.我为这份工作找到了这个C#库(tweetsharp). 他们的例子非常清楚,但是他们使用密码对用户进行身份验证. using TweetSharp;// Pass your credentials to the serviceTwitterService service = new TwitterService("co
我正在尝试在 Windows Phone中验证用户帐户.我为这份工作找到了这个C#库(tweetsharp).

他们的例子非常清楚,但是他们使用密码对用户进行身份验证.

using TweetSharp;

// Pass your credentials to the service
TwitterService service = new TwitterService("consumerKey","consumerSecret");

// Step 1 - Retrieve an OAuth Request Token
OAuthRequestToken requestToken = service.GetRequestToken();

// Step 2 - Redirect to the OAuth Authorization URL
Uri uri = service.GetAuthorizationUri(requestToken);
Process.Start(uri.ToString());

// Step 3 - Exchange the Request Token for an Access Token
string verifier = "123456"; // <-- This is input into your application by your user
OAuthAccessToken access = service.GetAccessToken(requestToken,verifier);

// Step 4 - User authenticates using the Access Token
service.AuthenticateWith(access.Token,access.TokenSecret);
IEnumerable<TwitterStatus> mentions = service.ListTweetsMentioningMe();

我想知道如果没有密码可以做到这一点吗?我尝试了不要求代码的应用程序.这是否意味着tweetsharp已经过时了?

不知道我是否仍然可以使用tweetsharp进行身份验证而不使用引脚部分?或者有没有替代SDK的Windows手机?

解决方法

在 TweetSharp页面上还提到了 xAuth

If you are building a mobile application and want to benefit from a
seamless authentication experience with no additional steps for the
user,you need to enroll your application in Twitter’s xAuth support.
You must complete this step in order for xAuth to function correctly.

using TweetSharp;

// OAuth Access Token Exchange
TwitterService service = new TwitterService("consumerKey","consumerSecret");
OAuthAccessToken access = service.GetAccessTokenWithXAuth("username","password");

回复您的评论,另一个选项是在移动应用程序中使用WebBrowser控件中打开的随播Web应用程序,请参阅https://github.com/danielcrenna/tweetsharp#authenticating-a-browser-application

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读