In navision 2017 I've a query and a Web Serwice with Odata V4 Url
In BC i try to get the data and till I had OnPrem it worked becouse I used the "UseWindowsAuthentication" in the HttpClient
Now I try to use the following code but I obtain 401 failed.
var
SOAPClient: HttpClient;
SOAPContent: HttpContent;
SOAPRequest: HttpRequestMessage;
SOAPRequestHeader: HttpHeaders;
Base64Convert: Codeunit "Base64 Convert";
begin
Clear(SOAPClient);
//Prepare request
SOAPRequest.SetRequestUri(Url);
SOAPRequest.Method := 'GET';
//set authorization and call request
//SOAPClient.UseWindowsAuthentication(User, Pass); // OnPrem only
SOAPRequest.GetHeaders(SOAPRequestHeader);
SOAPRequestHeader.Add('Authorization', StrSubstNo('Basic %1', Base64Convert.ToBase64(StrSubStNo('%1:%2', User, Pass))));
SOAPClient.Send(SOAPRequest, SOAPResponse);
Any suggestion?