SharePoint/NTLM authentication using Perl, 401 Unauthorized, Credentials for 'Domain\User' failed
SharePoint/NTLM authentication using Perl, 401 Unauthorized, Credentials for 'Domain\User' failed
(OP)
I am unable to authenticate to a SharePoint site using NTLM authentication, getting 401 Unauthorized, Credentials for 'Domain\User' failed. My password is correct, but I think I might be having an issues with headers or handshaking with the site. Please help!!
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET http://sharepoint.website.net
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::http::request: Keep the http connection to sharepoint.website.net:80
LWP::UserAgent::request: Simple response: Unauthorized
LWP::Authen::Ntlm::authenticate: authenticate() has been called
LWP::Authen::Ntlm::authenticate: In first phase of NTLM authentication
401 UnauthorizedFAILED!!!!!
Date: Wed, 30 Jul 2014 20:04:58 GMT
Server: Microsoft-IIS/7.5
WWW-Authenticate: NTLM
Content-Length: 0
Client-Date: Wed, 30 Jul 2014 20:04:58 GMT
Client-Peer: XXX.XX.XX.XXX:80
Client-Response-Num: 4
Client-Warning: Credentials for 'Domain\User' failed beforeMicrosoftSharePointTeamServices: 14.0.0.7113
SPRequestGuid: dedwdwdd380-dwe-wedwea-824d-ceb5dwdwdwb5
X-MS-InvokeApp: 1; RequireReadOnly
X-Powered-By: ASP.NET
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET http://sharepoint.website.net
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::http::request: Keep the http connection to sharepoint.website.net:80
LWP::UserAgent::request: Simple response: Unauthorized
LWP::Authen::Ntlm::authenticate: authenticate() has been called
LWP::Authen::Ntlm::authenticate: In first phase of NTLM authentication
401 UnauthorizedFAILED!!!!!
Date: Wed, 30 Jul 2014 20:04:58 GMT
Server: Microsoft-IIS/7.5
WWW-Authenticate: NTLM
Content-Length: 0
Client-Date: Wed, 30 Jul 2014 20:04:58 GMT
Client-Peer: XXX.XX.XX.XXX:80
Client-Response-Num: 4
Client-Warning: Credentials for 'Domain\User' failed beforeMicrosoftSharePointTeamServices: 14.0.0.7113
SPRequestGuid: dedwdwdd380-dwe-wedwea-824d-ceb5dwdwdwb5
X-MS-InvokeApp: 1; RequireReadOnly
X-Powered-By: ASP.NET
RE: SharePoint/NTLM authentication using Perl, 401 Unauthorized, Credentials for 'Domain\User' failed
RE: SharePoint/NTLM authentication using Perl, 401 Unauthorized, Credentials for 'Domain\User' failed
``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
RE: SharePoint/NTLM authentication using Perl, 401 Unauthorized, Credentials for 'Domain\User' failed
#!/usr/bin/env perl
use strict;
use warnings;
use LWP::Debug qw(+);
use LWP::UserAgent;
use HTTP::Cookies;
use HTTP::Request::Common;
use Authen::NTLM;
use Authen::Ntlm;
ntlmv2(1);
my $ua = new LWP::UserAgent(keep_alive => '300',
ssl_opts => { verify_hostname => 1 },);
my $url = 'http://harepointsite.net/page.aspx'; # website I am trying to hit
my $cookie_jar = HTTP::Cookies->new(
file => "/tmp/cookies.jira",
autosave => 1,
);
my $request = HTTP::Request->new('GET', $url);
$ua->cookie_jar( $cookie_jar );
$ua->credentials("sharepointsite.net:80", "", "DOMAIN\\USER","PASSWORD"); # user password not disclosed
$ua->agent("Mozilla/6.0");
print "--Performing request now...------------------\n";
my $response = $ua->request($request);
print "--Done with request---------------------------\n";
if( $response->is_success) {
print 'Error: ', $response->status_line, "\n";
print "===== Request Headers =====\n";
print $response->headers->as_string;
print "\n===== Response Headers ====\n";
print $response->headers->as_string;
print "\n===== Response Content ====\n";
print $response->content;
} else {
print 'Error: ', $response->status_line, "\n";
print "===== Request Headers =====\n";
print $response->headers->as_string;
print "\n===== Response Headers ====\n";
print $response->headers->as_string;
print "\n===== Response Content ====\n";
print $response->content;
exit 1;
}
RE: SharePoint/NTLM authentication using Perl, 401 Unauthorized, Credentials for 'Domain\User' failed
my $url = 'http://sharepointsite.net/page.aspx'; # website I am trying to hit
RE: SharePoint/NTLM authentication using Perl, 401 Unauthorized, Credentials for 'Domain\User' failed
RE: SharePoint/NTLM authentication using Perl, 401 Unauthorized, Credentials for 'Domain\User' failed
"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
RE: SharePoint/NTLM authentication using Perl, 401 Unauthorized, Credentials for 'Domain\User' failed
RE: SharePoint/NTLM authentication using Perl, 401 Unauthorized, Credentials for 'Domain\User' failed
#!/usr/bin/perl
use Authen::NTLM qw(ntlmv2);
use Data::Dumper;
use SharePoint::SOAPHandler;
use CopyTree::VendorProof;
use CopyTree::VendorProof::LocalFileOp;
delete $ENV{'https_proxy'};
my $sharepointobj = SharePoint::SOAPHandler ->new;
my $localfileobj = CopyTree::VendorProof::LocalFileOp ->new;
$sharepointobj->sp_creds_domain('operations.web.myworksite.com:443');
$sharepointobj->sp_creds_user('MYDOMAIN\myuserid');
$sharepointobj->sp_creds_password('Mypassword');
$sharepointobj->sp_authorizedroot('https://operations.web.myworksite.com:443/sites/CA...');
my $cpobj = CopyTree::VendorProof ->new;
print Dumper $sharepointobj->fdls('', 'Shared Documents');
$cpobj -> src('/opt/app/Reports/Excel/Reports_TABS1007.xlsx', $localfileobj);
$cpobj -> dst('Shared Documents/Reports_TABS1007.xlsx', $sharepointobj);
$cpobj -> cp;
print Dumper $sharepointobj->fdls('', 'Shared Documents');
Response:
$VAR1 = 'Shared Documents/Reports_TABS1006.xlsx';
$VAR2 = 'Shared Documents/Forms';
401 Unauthorized at /opt/app/perl/lib/perl5/SharePoint/SOAPHandler.pm line 374.