Reputation: 21
Can anyone explain to me how to get a username and password from a request header in ruby?
While communicating with another system, before I was sending the user name and password and now I have changed the user name and password in both the system. But still, I'm getting #<Net::HTTPUnauthorized 401 Unauthorized readbody=true> error
Upvotes: 0
Views: 705
Reputation: 559
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
Upvotes: 0
Reputation: 84
maybe this one request.headers
E.g
request.headers['username']
Upvotes: 0