使用 Twitter 和 OAuth 的客户端应用程序:我的方法正确吗?
我有一个用 .NET 4.0/C# 开发的应用程序。它旨在供想要监视硬件传感器并提醒他们特定值的客户使用。通知的一种选择是通过“发推文”到他们选择的 Twitter 帐户。在 Twitter 更改为 OAuth 之前,用户输入他们的帐户名和密码,这足以代表他们发送推文。
在阅读了 Twitter API 和 OAuth 后,我想看看我是否正确理解了维护此功能的最佳方法。
我已在 dev.twitter.com 注册了我的应用程序,并获得了必要的消费者密钥和消费者秘密。
该应用程序可能需要向多个 Twitter 帐户发送推文,因为每次安装都会有多个用户使用该应用程序。
如果我理解正确,我将需要执行以下操作:
为每个用户提供某种“请求授权”按钮,该按钮会启动 Twitter 身份验证网站。在那里,用户登录,然后获得 PIN 码。
使用PIN码获取用户的
AccessToken
和AccessTokenSecret
。在应用程序的会话(启动)之间存储这两个令牌。
我的问题:
在存储(在 SQL 中)时我应该加密这些令牌吗?
是否需要重新授权?该程序只需安装一次,然后即可在无人值守的情况下运行。重新授权帐户将会破坏交易。
虽然它不应该影响任何答案或建议,但我正在使用 TweetSharp 库。 >
I have an application that I've developed in .NET 4.0/C#. It's designed to be used by customers that want to watch hardware sensors and alert them of specific values. One option for notification is by "tweeting" to a Twitter account of their choice. Before Twitter changed to OAuth, users entered their account name and password and this was enough to send Tweets on their behalf.
After reading up on the Twitter API and OAuth, I want to see if I understand correctly the best way to maintain this functionality.
I've registered my application with dev.twitter.com and obtained the necessary Consumer Key and Consumer Secret.
The application may potentially need to tweet to more than one Twitter account as it is used by multiple users per installation.
If I understand things correctly I will need to do the following:
Provide some sort of "Request Authorization" button on a per-user basis, which launches a Twitter authentication web site. There, the user logs in and is then provided with a PIN number.
Use the PIN number to obtain the user's
AccessToken
andAccessTokenSecret
.Store both of these tokens between sessions (launches) of the application.
My questions:
Should I encrypt either of these tokens when storing (in SQL)?
Is it ever necessary to re-authorize? The program is intended to be setup just once, then run unattended. Re-authorizing accounts will be a deal-breaker.
Though it shouldn't affect any answers or advice, I am using the TweetSharp library.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的理解对我来说似乎很好。
Your understanding seems pretty good to me.