title: Authenticating OData using Curl for Dynamics Nav
body: <p>I'm trying to use Curl to pull some data from Microsoft Dynamics Nav.</p>
  
  <p>I can easily access it through my browser at this url: <code>http://kevans:(password)@192.168.0.30:8048/Sandbox/OData/</code> and it works perfectly fine. </p>
  
  <p>In Curl, I tried this: <code>curl --ntlm -u kevans "http://192.168.0.30:8048/Sandbox/OData/" -v</code>, type in my password at the prompt, but it returns a 401 Unauthorized error.</p>
  
  <p>Is there something that needs to be done to make it available to Curl?</p>
  
  <p>Here's the output of Curl:</p>
  
  <pre><code>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'
  &gt; GET /Sandbox/OData/ HTTP/1.1
  &gt; Authorization: NTLM TlRMTVNTUAABAAAAt4II4gAAAAAAAAAAAAAAAAAAAAAGA4AlAAAADw==
  &gt; User-Agent: curl/7.33.0
  &gt; Host: 192.168.0.30:8048
  &gt; Accept: */*
  &gt;
  &lt; HTTP/1.1 401 Unauthorized
  &lt; Content-Length: 0
  * Server Microsoft-HTTPAPI/2.0 is not blacklisted
  &lt; Server: Microsoft-HTTPAPI/2.0
  &lt; WWW-Authenticate: Negotiate
  &lt; Date: Thu, 05 Feb 2015 20:25:26 GMT
  &lt;
  * Connection #0 to host 192.168.0.30 left intact
  </code></pre>
  
  <p>Things I've tried:</p>
  
  <ul>
  <li>using the <code>--negotiate</code> argument along with <code>--ntlm</code></li>
  <li>using <code>--anyauth</code></li>
  <li>using my domain <code>-u MYDOMAIN\kevans</code></li>
  <li>using <code>-u MYDOMAIN\kevans:password</code> and <code>-u kevans:password</code></li>
  </ul>