×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

SharePoint/NTLM authentication using Perl, 401 Unauthorized, Credentials for 'Domain\User' failed

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

RE: SharePoint/NTLM authentication using Perl, 401 Unauthorized, Credentials for 'Domain\User' failed

(OP)
I am using NTLM 1.09

RE: SharePoint/NTLM authentication using Perl, 401 Unauthorized, Credentials for 'Domain\User' failed

if you still have a problem with it please share some more light, as for example the script with which you are trying to connect

``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

(OP)
thanks, here is my script - this is still not working:

#!/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

(OP)
this is the url:

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

(OP)
Also wanted to point out that my ad account gets locked...

RE: SharePoint/NTLM authentication using Perl, 401 Unauthorized, Credentials for 'Domain\User' failed

(OP)
I made up the website since its internal. It is an example of what I am trying to hit

RE: SharePoint/NTLM authentication using Perl, 401 Unauthorized, Credentials for 'Domain\User' failed

Not sure if this is the right place to post this, but maybe someone can help with a similar issue. I'm trying to copy files from a linux server to a sharepoint. I've got the connection working on the display of the sharepoint. There is 1 file out there to view. But I get a 401 Unauthorized on the copy. Why would I be successful on the display but not the copy?



#!/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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close