Reputation: 5187
I'm developing a Rails application that use devise as the authentication solution. For web applications, users enter username and password in a form, Rails can render different pages after users signed in.
Now I'd like to use this framework to support mobile app. In this case, the mobile app needs to know whether the user enters correct username and password.
How should devise response to the mobile application, response headers or JSON inside body? Does devise support it?
Upvotes: 0
Views: 148
Reputation: 5187
More tutorials:
http://blog.joshsoftware.com/2011/12/23/designing-rails-api-using-rabl-and-devise/
Make sure to enable/uncomment the following line in devise configuration:
config.token_authentication_key = :auth_token
Upvotes: 1
Reputation: 6029
You need token authentication. Mobile client should have a login form and access the REST API for authentication. If authentication was successful, you will get a token which you need to send with all the subsequent requests in the same session.
http://zyphdesignco.com/blog/simple-auth-token-example-with-devise
http://matteomelani.wordpress.com/2011/10/17/authentication-for-mobile-devices/
Upvotes: 0