How do I make OmniAuth Identity accept JSON post data?

六眼飞鱼酱① 提交于 2020-01-13 06:07:29

问题


I'm using OmniAuth-Identity for log ins, and logging in using Ajax calls. Attempts to log in passing JSON data don't work.

For instance this works:

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

This doesn't, it returns "invalid credentials"

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"

Is this a known issue? Form encoding my data will be difficult as I'm using AngularJS.

UPDATE:

One of the rails guys fixed it by backporting JSON support into Rack.

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

I'm hesitant to post that as an answer becase I don't understand the details of Rack well enough to explain anything. But the relevant diff is here: https://github.com/ssoroka/rack/commit/d8e2e2af6da57805d2f0906ce925ea150def31a0

来源:https://stackoverflow.com/questions/23658498/how-do-i-make-omniauth-identity-accept-json-post-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!