Solved

LWP::UserAgent Authentication - how to get password

Posted on 2004-04-22
3
580 Views
Last Modified: 2012-05-04
Hi,


I am trying to use LWP::UserAgent to retrieve password protected web
page. Since, my page is also password protected, I need to send
'Authorization' http header (encoded in base64) to other page. Both applications use same user name and password. How can I read password or 'Authorization' header in my script to make the following statement work:

$req->authorization_basic($username, $password);
OR
$req->authorization('Basic cm1vaSHGFsdfTNteFxs');   #cm1vaSHGFsdfTNteFxs is username:password encoded in base64

Thanks,
Rakesh.
0
Comment
Question by:rakmohan
3 Comments
 
LVL 20

Accepted Solution

by:
jmcg earned 500 total points
ID: 10970523
There's a limitation here. In the CGI environment your script is run in, it does not have full access to the headers of the HTTP request that caused it to start. You can learn, from environment variables, the AUTH_TYPE and REMOTE_USER. This means you would need to have stored the password corresponding to the user somewhere where your script can access it -- it cannot simply read or pass along the Authentication: header that was received.
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question