通过 Ruby 的 OAuth 传递参数
我正在使用 Mirven 的 Twitter OAuth Sinatra 示例,并试图弄清楚如何才能使用 Oauth 请求发送“下一页”参数:
即。用户尝试访问需要登录的 /edit/profile
,因此我重定向到 /request
,它处理通过 Twitter 的登录 - 我现在希望能够重定向用户如果登录成功,则转到他们最初查找的地址。
我想我可以在 .get_request_token
line 包含以下代码:
@request_token = @consumer.get_request_token({:oauth_callback => "http://#{request.host}/auth"},{:next => params['next'] || '/'})
但是 params
在 /auth
处理程序中没有其他项目。
我是 OAuth 新手,我该怎么做?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它比我想象的更简单,只需将参数添加到 oauth_callback url,如下所示:
然后将逻辑放入您的
/auth
处理程序中,以根据params['next']
进行重定向Its simpler than I thought, just add your parameters to the oauth_callback url like so:
Then put logic in your
/auth
handler to redirect according toparams['next']