rweiche has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to access a website that uses Single Sign On and cannot seem to get past the login form
use WWW::Mechanize; $mech = WWW::Mechanize->new(); $mech->cookie_jar(HTTP::Cookies->new()); $mech->get('http://mysite.com'); my @webforms = $mech->forms(); foreach my $form (@webforms) { my @inputfields = $form->param; foreach my $inputfield (@inputfields) { if ($inputfield =~ /userID/) { $mech->set_fields($inputfield => "login"); print "Setting userid\n"; } if ($inputfield =~ /pass/) { $mech->set_fields($inputfield => "password"); print "Setting password\n"; } print $inputfield . "\n"; } } $mech->click(); $statVal = $mech->status(); print $statVal . "\n";
Debug Info:
__VIEWSTATE - is a hidden field so assumed it is handled
__VIEWSTATEGENERATOR - is a hidden field so assumed it is handled
__EVENTVALIDATION - is a hidden field so assumed it is handled
ctl00$ContentPlaceHolder1$userID - login id set to this
ctl00$ContentPlaceHolder1$pass - password set to this
Received a 200 back but still stay on the login page
I know SSO uses headers as well as _VIEWSTATE but assuming that setting up the cookie jar would capture
Any pointers to further debugging or what I am missing?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Mechanize and Single Sign On
by Anonymous Monk on Dec 08, 2014 at 18:08 UTC | |
|
Re: Perl Mechanize and Single Sign On
by wazat (Monk) on Dec 08, 2014 at 17:53 UTC | |
|
Re: Perl Mechanize and Single Sign On
by Gangabass (Vicar) on Dec 09, 2014 at 13:06 UTC | |
|
Re: Perl Mechanize and Single Sign On
by locked_user sundialsvc4 (Abbot) on Dec 08, 2014 at 17:28 UTC |