如何让OmniAuth Identity接受JSON帖子数据?

时间:2014-05-14 15:05:49

标签: ruby-on-rails json omniauth

我正在使用OmniAuth-Identity进行登录,并使用Ajax调用登录。尝试登录传递JSON数据不起作用。

例如,这有效:

curl -i -H "Accept: application/json" -d "auth_key=joe@example.com&password=cheesestix" "http://0.0.0.0:3000/auth/identity/callback"

这不,它返回“无效凭证”

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -d '{"auth_key":"joe@example.com","password":"cheesestix"}' "http://0.0.0.0:3000/auth/identity/callback"

这是一个已知问题吗?当我使用AngularJS时,表单编码我的数据会很困难。

更新:

其中一个铁路工作人员通过将JSON支持向后移植到Rack中来修复它。

gem 'rack', git: 'https://github.com/ssoroka/rack.git', branch: '1.5.2-json-support-backport'

我很犹豫要发布这个答案因为我不太了解Rack的细节,足以解释任何事情。但相关差异在于:https://github.com/ssoroka/rack/commit/d8e2e2af6da57805d2f0906ce925ea150def31a0

0 个答案:

没有答案