CURL always returns 401 with NTLM

I am working on a library to communicate with Microsoft Exchange using PHP. Everything works fine on my production servers, but I keep getting 401 Unauthorized on my development machine. I tried using curl from the command line and get the same results.

Using the following command "401" on my machine:

curl https://mail.example.com/EWS/Exchange.asmx -w %{http_code} --ntlm -u username:password 

The exact same call returns “302” on my production machines, which I expect.

My development machine uses curl 7.19.7, and my production machine uses curl 7.18.0.

+8
linux curl ntlm
source share
2 answers

This is an old question, but if it can finally help someone, I decided that I would send an answer.

There is an error with NTLM and curl in some latest version of Ubuntu (10.04 and higher, I think).

If you use curl module for PHP on ubuntu and your version of libcurl is subject to this error, this may explain why your authentication requests do not work.

If you add the verbose flag to your command (-v), you should see something like this in the answer part:

  • gss_init_sec_context () failed :: Credential cache file '/ tmp / krb5cc_1000' not found.

If you see this, an error affects you, and you will either have to downgrade your library or find another machine.

Hope this helps: P

+7
source share

For all Centos / RHEL 6.X users, check out:

https://bugzilla.redhat.com/show_bug.cgi?id=953864

0
source share

Source: https://habr.com/ru/post/649776/


All Articles