Hi!

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:

before_filter :authenticate_user!
respond_to :json
...
  respond_with current_user
...

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?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/DZTrqDb7TsUJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to