I'm working on a library to communicate with Microsoft Exchange using PHP. Everything works fine on my production servers, but I keep getting a 401 Unauthorized on my development machine. I tried using curl from the command line and I get the same results.
Using the following returns "401" on my machine:
curl https://mail.example.com/EWS/Exchange.asmx -w %{http_code} --ntlm -u username:password
The same exact call returns "302" on my production machines, which is what I expect.
My development machine is using curl 7.19.7 and my production machine is using curl 7.18.0.
This is an old question but if it can eventually help anybody, I figured I'd post an answer.
There's a bug with NTLM and curl on certain recent version of Ubuntu (10.04 and up I believe).
If you're using the curl module of PHP on ubuntu and your libcurl version is affected by this bug, this could explain why your authentication requests are failing.
If you add the verbose flag to your command (-v), you should see something like this in the response part:
If you do see this, you're affected by the bug and you'll have to either downgrade your library or find another machine.
I hope this helps :P
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With