I use Devise and Basic HTTP Authentication to access user areas from a mobile app. When the user enters its details in the app and it tries to “login” (you don’t actually login with basic auth as you send the credentials with each request) I want to get a response back with the user info, like user ID, email (not password) etc.
- So, is there a way to do this out of the box with Devise?
If not I guess I could just create a “login” controller with an “index”-action that just has:
So when I do a request from my app to http://example.com/login/ Devise will return an error by default if the username and password are incorrect, and if the credentials are correct it outputs the user object as JSON.
Are there any issues with the approach above?