AL icon indicating copy to clipboard operation
AL copied to clipboard

NTLM Authentication with HttpClient

Open jcooper01 opened this issue 9 years ago • 6 comments

We need to be able to do Basic authentication and NTLM authentication with the HttpClient. I don't see a way to do that. I suppose that for Basic, we could manually construct and add the header ourselves, but that's not practical with NTLM.

jcooper01 avatar Aug 28 '17 16:08 jcooper01

Actually, you can do Basic Authentication with HttpClient. Here is how:

var
  RequestMessage : HttpRequestMessage;
  Headers : HttpHeaders;
  TempBlob : Record TempBlob temporary;
begin
  RequestMessage.GetHeaders(Headers);
  AuthText := StrSubstNo('%1:%2',Parameters.UserName,Parameters.Password);
  TempBlob.WriteAsText(AuthText,TextEncoding::Windows);
  Headers.Add('Authorization', StrSubstNo('Basic %1',TempBlob.ToBase64String()));
end

ajkauffmann avatar Aug 29 '17 06:08 ajkauffmann

Right. That's what I meant by generating the header manually. However, we also need NTLM support.

jcooper01 avatar Aug 29 '17 10:08 jcooper01

It's on our backlog, no timeframe yet.

StanislawStempin avatar Sep 01 '17 14:09 StanislawStempin

Hi, @StanislawStempin any update on this?

nareshwar avatar Feb 25 '19 12:02 nareshwar

Hi! NTLM support is available in the dev preview and will be shipped in the next major release. Please try it out and let us know what you think!

atoader avatar Feb 26 '19 07:02 atoader

https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/httpclient/httpclient-usedefaultnetworkwindowsauthentication-method

https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/httpclient/httpclient-usewindowsauthentication-method

atoader avatar Aug 07 '19 12:08 atoader