在用户提交表单时使用Tweepy OAuth对用户进行身份验证 [英] Using Tweepy OAuth to authenticate a user when they submit a form
问题描述
我正在构建一个需要使用OAuth的网络应用程序(使用Django)。我正在使用Tweepy,并且已经安装并导入了它。现在,我不知道要设置它,以便当用户单击表单上的提交按钮时,要求他们通过Twitter登录。我遵循了许多不同的教程/博客来尝试使其正常运行,但似乎无法破解。
I'm building a web app (using Django) in which I need to use OAuth. I'm using Tweepy and have installed and imported it. I now have no idea to set it up so that when a user hits the "Submit" button on my form, they are asked to Log in via Twitter. I have followed a number of different tutorials/blogs to try and get it working but I can't seem to crack it.
这是我要遵循的流程:
- 用户使用以下方式提交消息表单
- 要求用户验证Twitter帐户
- 表单中的消息和Twitter详细信息(@用户名,屏幕名称,个人资料图片等)是存储在数据库中(使用SQLite3)
- 用户被重定向到index.html,在那里他们看到他们在类似最新消息的Twitter提要中提交的消息。
- User submits a message using the form
- User is asked to authenticate Twitter account
- Message from the form and Twitter details (@username, screen name, profile pic etc) are stored in database (using SQLite3)
- User is redirected to index.html where they see the message they submitted in a Twitter-like feed of "Latest messages".
我真的被卡住了,所以不胜感激!
I'm really stuck so any help would be much appreciated!
推荐答案
我试图做同样的事情,除此之外,表单内容会自动发送给用户墙。
I tried to do the same thing, in addition to that, the form content is automatically twitted to user wall.
您需要在此处按照教程进行操作
You need to follow the tutorial here
http://packages.python.org/tweepy/html/auth_tutorial.html#oauth-authentication
这篇关于在用户提交表单时使用Tweepy OAuth对用户进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!