plataformatec/devise — Issue #1471: Devise not responding correctly to JSON message
Author: marcolinux
Created: 2011-11-28 23:30:38+00:00
State: open

I am having troubles in having Devise responding correctly to a JSON message.

the following request is working fine

curl -XPOST 'http://localhost:5000/users/sign_in.json' -d 'user[email]=MYUSER' -d 'user[password]=MYPASSWORD'
>Completed 201 Created in 171ms

In place, I would like to have a more proper JSON format

curl -v -b cookie.file -c cookie.file -H "Content-Type: application/json" -X POST -d '{"user" : {"mail":"MYUSER" , "password":"MYPASSWORD" }}' http://localhost:5000/users/sign_in.json

But it does not seem to work

>Processing by Devise::SessionsController#create as JSON 23:10:32 web.1 | Parameters: {"user"=>{"mail"=>"MYUSER", "password"=>"[FILTERED]"}, "session"=>{"user"=>{"mail"=>"MYUSER", "password"=>"[FILTERED]"}, "action"=>"create", "controller"=>"devise/sessions", "format"=>"json"}}
Completed 401 Unauthorized in 11ms

thanks