jenius-apps / nightingale-rest-api-client

A modern, resource-efficient REST API client for Windows
https://nightingale.rest
MIT License
759 stars 36 forks source link

Canon CCAPI Digest Authentication #114

Open myokeeh opened 4 years ago

myokeeh commented 4 years ago

Hi @dpaulino! I can't believe it's close to a year since I've requested Digest authentication, and only now finally trying it out again. https://twitter.com/carlomendoza/status/1179785549604773888?s=20

Nightingale appears to work fine if I disable digest authentication on the camera, but when it's enabled, getting this:

The remote server returned an error: (500) Internal Server Error. at System.Net.HttpWebRequest.d194.MoveNext() + 0x742 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17 at System.Net.HttpWebRequest.GetResponse() + 0x66 at System.Net.HttpWebRequest.GetResponse() + 0x95 at Nightingale.Core.Client.Authenticators.DigestAuthenticator.GetResponse(Uri) + 0x289 at Nightingale.Core.Client.Authenticators.DigestAuthenticator.GetAuthHeader(Uri, String, String) + 0x129 at Nightingale.Core.Client.NightingaleClient.SetAuth(Item, HttpRequestMessage) + 0x403 at Nightingale.Core.Client.NightingaleClient.d8.MoveNext() + 0x256 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17 at Nightingale.Core.Client.NightingaleClient.d6.MoveNext() + 0x156 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17 at Nightingale.Core.Services.RequestSender.d5.MoveNext() + 0x14c

dpaulino commented 4 years ago

Thanks for the report. I'll look into this as soon as possible!

myokeeh commented 3 years ago

As of 4.3.1.0, here's my latest test results with digest auth.

I neglected to mention that on the first request, I get a JSON reply below.

{ "message": "Internal error" }

Subsequent requests give me "Oops, something went wrong with the request and we lost our grip on it" with the stack trace below.

The remote server returned an error: (500) Internal Server Error. at System.Net.HttpWebRequest.d194.MoveNext() + 0x742 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17 at System.Net.HttpWebRequest.GetResponse() + 0x66 at System.Net.HttpWebRequest.GetResponse() + 0x95 at Nightingale.Core.Client.Authenticators.DigestAuthenticator.GetResponse(Uri) + 0x289 at Nightingale.Core.Client.Authenticators.DigestAuthenticator.GetAuthHeader(Uri, String, String) + 0x129 at Nightingale.Core.Client.NightingaleClient.SetAuth(Item, HttpRequestMessage) + 0x403 at Nightingale.Core.Client.NightingaleClient.d9.MoveNext() + 0x1fc --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17 at Nightingale.Core.Client.NightingaleClient.d7.MoveNext() + 0x14f --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17 at Nightingale.Core.Services.RequestSender.d5.MoveNext() + 0x152