Twitter的API - OOB流 [英] Twitter API - OOB Flow
问题描述
我正在开发一个移动应用程序需要访问到Twitter。有一吨与使用与Web应用Twitter的API文档,但我有一个很难找到正确的流量或使用台式机和放出来的带外/ PIN码模式的例子;移动应用。
I'm developing a mobile application that needs access to Twitter. There's a ton of documentation relating to using the Twitter API with web apps, but I'm having a hard time finding the correct flow or any examples using out-of-band/PIN code mode for desktop & mobile applications.
任何人都可以点我一个链接或一些代码示例(preferebly在C#),可以告诉我如何使用Twitter的API从桌面或移动应用程序?
Can anyone point me to a link or some code examples (preferebly in C#) that can show me how to use the Twitter API from a desktop or mobile application?
感谢。
推荐答案
有OOB流的一些介绍在 http://dev.twitter.com/pages/auth
There is some description of OOB flow in the Glossary section at the bottom of http://dev.twitter.com/pages/auth
带外模式 - 取而代之的收购请求令牌时,提供了一个基于URL的回调,OOB提供。一旦用户给他们的Twitter帐户凭据,它们都带有包含PIN码的屏幕,并要求输入验证码到应用程序中。然后,应用程序发送此引脚作为oauth_verifier到访问令牌的步骤来完成交换。
out of band mode - Instead of providing a URL-based callback when acquiring a request token, "oob" is supplied. Once the user has given Twitter their account credentials, they are presented with a screen containing a PIN code and are asked to enter this code into the application. The application then sends this PIN as an oauth_verifier to the access token step to complete the exchange.
在实践中,这意味着什么,比起在正常的Web流量:
What that means in practice, compared to the normal web flow:
- 在步骤(A)您的应用程序启动时打开一个浏览器窗口中的OAuth流的流动,但发送请求参数
oauth_callback = OOB
,而不是回调网址 - 步骤(C)与Twitter显示包含一个PIN码授权结果页结束为用户(而不是使回调到与正常的网络流量您的应用程序)
- 步骤(D)要求用户拷贝/键入从Twitter的认证页面PIN码到您的应用程序(您的应用程序显然需要某种形式的等待授权码...屏幕这样的:)
- 步骤(E),您的应用程序将在用户中输入回Twitter的PIN码在
oauth_verifier
参数,以获得访问令牌。
- In step (A) your app starts the flow by opening a browser window to the OAuth flow, but sends a request param of
oauth_callback=oob
rather than a callback URL - Step (C) ends with Twitter displaying an authorization result page containing a PIN for the user (rather than making a callback to your app with the normal web flow)
- Step (D) requires the user to copy / type the PIN from the Twitter authentication page into your app (your app obviously needs some kind of "Waiting for authorization code..." screen for this :)
- Step (E) your app sends the PIN entered by the user back to Twitter in the
oauth_verifier
param to get an access token.
尝试在OAuthConsumerWpf样本DotNetOpenAuth http://www.dotnetopenauth.net/ 获得的OAuth用户代码的例子,你应该能够修改
Try the OAuthConsumerWpf sample in DotNetOpenAuth http://www.dotnetopenauth.net/ for an example of OAuth Consumer code that you should be able to modify.
这篇关于Twitter的API - OOB流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!