I would like to know how to use rails as backend for my iOS app.
All I need is a User with email and password to authenticate using devise. I already have a User created with devise and rails 4.
I did find this post http://jessewolgamott.com/blog/2012/01/19/the-one-with-a-json-api-login-using-devise/ explaining what I need, but some things are still missing.
When I try to do a POST via my iOS app, I get the message "Can't verify CSRF token authenticity". How do I solve that without skipping the filter verify_authenticity_token ?
How would the request code for the iOS look like? Right now I'm doing a
POST
tohttp://localhost:3000/api/users/sign_in.json
and setting theHTTPBody = [NSJSONSerialization dataWithJSONObject:jsonDictionary options:0 error:&jsonError]
, but the rails server is receiving only a string as key with the entire json dictionary, not an actual json dictionary.params = {"{\"user\":{\"email\":\"qwe\",\"password\":\"123\"}}"=>nil, "action"=>"create", "controller"=>"api/sessions", "format"=>"json"}
How would I do an https request instead of http, so I can hide the password and email fields in case someone else tries to watch my internet traffic?
Thank you very much.