Reputation:
I'm trying to use Curl to pull some data from Microsoft Dynamics Nav.
I can easily access it through my browser at this url: http://kevans:(password)@192.168.0.30:8048/Sandbox/OData/
and it works perfectly fine.
In Curl, I tried this: curl --ntlm -u kevans "http://192.168.0.30:8048/Sandbox/OData/" -v
, type in my password at the prompt, but it returns a 401 Unauthorized error.
Is there something that needs to be done to make it available to Curl?
Here's the output of Curl:
curl --ntlm -u kevans "http://192.168.0.30:8048/Sandbox/OData/" -v
Enter host password for user 'kevans':
* About to connect() to 192.168.0.30 port 8048 (#0)
* Trying 192.168.0.30...
* Adding handle: conn: 0x525fe0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x525fe0) send_pipe: 1, recv_pipe: 0
* Connected to 192.168.0.30 (192.168.0.30) port 8048 (#0)
* Server auth using NTLM with user 'kevans'
> GET /Sandbox/OData/ HTTP/1.1
> Authorization: NTLM TlRMTVNTUAABAAAAt4II4gAAAAAAAAAAAAAAAAAAAAAGA4AlAAAADw==
> User-Agent: curl/7.33.0
> Host: 192.168.0.30:8048
> Accept: */*
>
< HTTP/1.1 401 Unauthorized
< Content-Length: 0
* Server Microsoft-HTTPAPI/2.0 is not blacklisted
< Server: Microsoft-HTTPAPI/2.0
< WWW-Authenticate: Negotiate
< Date: Thu, 05 Feb 2015 20:25:26 GMT
<
* Connection #0 to host 192.168.0.30 left intact
Things I've tried:
--negotiate
argument along with --ntlm
--anyauth
-u MYDOMAIN\kevans
-u MYDOMAIN\kevans:password
and -u kevans:password
Upvotes: 5
Views: 4609
Reputation: 278
I was having the same problem, but ended up with a different solution. I'm just putting mine here in case anyone is still having issues with this.
After making these changes, the CURL HTTP Response header "WWW-Authenticate: Negotiate" should now be "WWW-Authenticate: NTLM" and your curl request should match the following:
curl -v --ntlm -u 'username:password' "http://YOUR_NAV_URL:8048/NAV_INSTANCE_NAME/OData/"
Upvotes: 2
Reputation:
I updated Curl from 7.33 to 7.40 and it works fine now. I'm using the EXACT SAME COMMAND and it works without issue. The domain is completely optional and doesn't seem to affect it.
Upvotes: 2