Home > front end >  How can I retrieve Basic Authentication credentials from the header in ruby?
How can I retrieve Basic Authentication credentials from the header in ruby?

Time:11-19

Can anyone explain to me how to get a username and password from a request header in ruby?

CodePudding user response:

maybe this one request.headers

E.g request.headers['username']

CodePudding user response:

Simplest way to do so is to access request.headers

request.headers[:password]
# or
request.headers['password']

If you're unsure about the headers you're sending/receiving you can always do

raise request.headers.inspect
  • Related