In PHP, we can use $_SERVER['PHP_AUTH_PW']
to get the password entered by the user from apache basic authentication.
How do we go by doing this in Rails?
EDIT: $_SERVER['PHP_AUTH_USER']
is equivalent to request.env['REMOTE_USER']
.
In PHP, we can use $_SERVER['PHP_AUTH_PW']
to get the password entered by the user from apache basic authentication.
How do we go by doing this in Rails?
EDIT: $_SERVER['PHP_AUTH_USER']
is equivalent to request.env['REMOTE_USER']
.
What eventually did it for me is this:
require 'base64'
user_pass = Base64.decode64(request.authorization.split(' ')[1])
username = user_pass.split(':')[0]
password = user_pass.split(':')[1]