I am using Devise gem in my Rails app for authentication. I could able to create user by passing data in Json request format to devise rails app from Titanium mobile application.
But when i try to set up login in mobile app to use devise, it shows an error like below
{"error":"You need to sign in or sign up before continuing."}
My code looks like below
var regDetails = '{"email": "'+userNmTxt.value+'", "password": "'+passwordTxt.value+'"}';
var client = Titanium.Network.createHTTPClient({timeout: 5000});
client.open("POST", "http://10.100.85.43:3000/session/create");
client.setRequestHeader("Content-Type", "application/json");
client.send(regDetails);
client.onload = function(e)
{
alert('Logged in successfully' + this.responseText);
}
client.onerror = function(e)
{
alert('On error' + this.responseText);
}
What am i doing wrong?
I found the solution, i was missing some routing information in
routes.rbfileHope this will help someone 🙂