Rails: Accessing the username/password used for HTTP Basic Auth?

Posted by Shpigford on Stack Overflow See other posts from Stack Overflow or by Shpigford
Published on 2010-03-08T05:27:13Z Indexed on 2010/03/08 5:36 UTC
Read the original article Hit count: 312

I'm building a basic API where user information can be retrieved after that user's login and password are correctly sent.

Right now I'm using something like this:

http://foo:[email protected]/api/user.xml

So, what I need to do is access the user/password sent in the request (the foo and bar) but am not sure how to access that info in a Rails controller.

Then I'd check those variables via a quick User.find and then set those as the username and password variables for authenticate_or_request_with_http_basic.

It's possible I'm looking at this at the completely wrong way, but that's where I'm at right now. :)

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about authentic