Turns out that the problem is not Jayrock, but two things. One, the .NET HTTP client does not send the authorization header on the first request even with
PreAuthenticate set to
true. If you're interested in the details, the following blog post does a fabulous job of explaining what happens:
The second problem is that the Nutshell CRM API does not send back an WWW-Authenticate header on 401 (which is odd). If it did, the .NET HTTP client would re-submit the request with credentials. In the absence of WWW-Authenticate headers, the client does not know which authentication scheme the server understands and expects.
I have posted a
gist that makes JsonRpcClient work against Nutshell CRM by manually forcing the authorization header with the first request. I do this subclassing by
JsonRpcClient and overriding
GetRequest to get a crack at the request object before passing it on to the base class where the JSON encoding is done.
Hope this helps.
- Atif