Twitterizer:在用户个人资料上发布消息的工作流程是什么?
当我开始使用 Twitterizer 以便在某人的墙上发布内容时,我正处于混乱的时期。 有一个页面(我的例子是 DefaultTwitter.aspx),其中包含使用提供的令牌在 Twitter 上进行身份验证的链接。转到 Twitter 并返回 CallbackTwitter.aspx 并带有 outh_token 和机密。这样用户就被识别了。在 Twitterizer 上的示例中说道:
第 5 步 - 存储结果 您现在应该存储访问令牌和用户详细信息。请记住, 访问令牌失效的唯一方法是用户通过登录撤销访问权限 进入推特。否则,这些值将授予您访问该用户数据的权限 永远。
我的问题是: - 我是否应该将任何数据存储在 SQL 数据表中以及到底是什么(但我希望情况并非如此)
- 有人说我应该保存在cookie(我在会话中想到);但是,如果另一个用户来了,那么我应该如何创建一个注销按钮或类似的东西?
- 如果用户愿意,他将如何撤销应用程序访问权限?
一个活生生的例子将非常感激,因为我在互联网上找不到任何 twitter api 到底是如何工作的。
as I started to work with Twitterizer in order to publish on someone's wall I am in confusing time.
There is a page, my case, DefaultTwitter.aspx where is link to authenticate on twitter with token provided. Goes on Twitter and comes back to CallbackTwitter.aspx with outh_token and secret. And so the user is identified. On twitterizer example says:
Step 5 - Store the results
You should now store the access token and the user details. Keep in mind that the
only way an access token will become invalid is if the user revokes access by logging
into Twitter. Otherwise, those values will grant you access to that user's data
forever.
My questions are: - should I store any data in SQL datatable and what exactly(however I hope that is not the case to do so)
- somebody said that I should save in a cookie(I thought in session); however then if another user comes then how should I create a button to logout or something like that?
-how will user revoke application access if he would like so?
A live example will be much appreciated as I could not found any on internet how exactly twitter api works.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您的应用程序完成获取访问用户数据的授权时,结果就是访问令牌(由 2 个值表示,一个密钥和一个秘密)。这些值实际上是您可以在代表该用户向 API 发出的请求中使用的用户名/密码。* 将这些值保存在您的 SQL 数据库中。您还将获得用户 ID 和屏幕名称。将它们也放在手边可能是个好主意。
用户可以通过访问 http://twitter.com/settings/applications 撤销对应用程序的访问权限,找到该应用程序并单击其旁边的撤销访问按钮。您的应用程序无法撤销用户的访问权限。
您要求提供示例,但您引用了示例应用程序。只需查看该示例中的源代码即可。
* - 这是为了解释而进行的简化。 OAuth 专家请不要折磨我。
When your application finishes getting authorization to access the user's data, the result is the access token (represented by 2 values, a key and a secret). Those values are, in effect, the username/password you can use in requests to the API on behalf of that user.* Save those values in your SQL database. You'll also be given the user id and screen name. It's probably a good idea to keep those handy, too.
The user can revoke access to an application by going to http://twitter.com/settings/applications, finding the application and clicking the revoke access button next to it. Your application cannot revoke access for the user.
You asked for an example, but you're citing the example application. Just look at the source code in that sample.
* - That's a simplification for explanation sake. Please don't crucify me, OAuth experts.