Django Piston 问题 - “oauth_user_auth() 恰好需要 1 个参数(给定 2 个)”
我在设置 Django Piston 时遇到一些问题。我已经设法通过此处显示的 oauth_client.py 示例生成身份验证(http ://github.com/clemesha/django-piston-oauth-example)。当我运行“python oauth_client.py”时,我被带到 http://localhost: 8000/api/oauth/authorize/?oauth_token=8wm33jeWR92BpsrHjs 然后我勾选一个框以确认访问,然后提交表单。
此时我遇到了“oauth_user_auth() 恰好需要 1 个参数(给定 2 个)”错误。我确信,简单的答案是 oauth_user_auth 方法不接受一个参数,但要删除该字符,我必须编辑一个活塞文件,我对此有点犹豫。以前有其他人遇到过这个问题吗?
I am having a few problems setting up Django Piston. I have managed to get as far as generating authentication via the oauth_client.py sample shown here (http://github.com/clemesha/django-piston-oauth-example). When I run "python oauth_client.py" i am taken to http://localhost:8000/api/oauth/authorize/?oauth_token=8wm33jeWR92BpsrHjs where I then tick a box to confirm access and then submit the form.
At this point i hit a "oauth_user_auth() takes exactly 1 argument (2 given)" error. Simple answer, i'm sure, is that the oauth_user_auth method doesnt accept one parameter, but to remove that character i would have to edit a piston file, which i'm a little reticent to do so. Has anyone else come across this issue before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此问题源于您的 OAuth 使用者未指定任何回调 URL。您的调用应如下所示:
http://localhost :8000/api/oauth/authorize/?oauth_token=8wm33jeWR92BpsrHjs&oauth_callback=http://www.myoauthconsumer.com/receive_authorization/
http://www.myoauthconsumer.com/receive_authorization/ 如果服务提供商已授予授权,则应请求访问令牌...
oauth.net 上的这张图对于理解oauth协议的工作流程非常有帮助。
This problem comes from the fact that your OAuth consumer does not specify any callback URL. Your call should look like this:
http://localhost:8000/api/oauth/authorize/?oauth_token=8wm33jeWR92BpsrHjs&oauth_callback=http://www.myoauthconsumer.com/receive_authorization/
http://www.myoauthconsumer.com/receive_authorization/ should request an access token if authorization has been granted by the service provider...
This diagram at oauth.net is very helpful for understanding the workflow of the oauth protocol.