0

Is there any package/documentation/sample code available to call a http request using NTLM authentication in Laravel.

I tried to the below was to first authenticate and then send the NTLM token from response header and call the request again.

$response = Http::withHeaders([
            "Host" => $my_host_name,
            "Connection" => "keep-alive",
            "Authorization" => "NTLM TlRMTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
        ])->get($MY_URL);
$authKey = $response->header('WWW-Authenticate');

$response = Http::withHeaders([
            "Host" => $my_host_name,
            "Connection" => "keep-alive",
            "Authorization" => $authKey,
            "Cache-Control" => "no-cache"
        ])->get($MY_URL);
dd($response);

Getting a 400 Bad Request error.

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • Good code indentation would help us read the code and more importantly it will help **you debug your code** [Take a quick look at a coding standard](https://www.php-fig.org/psr/psr-12/) for your own benefit. You may be asked to amend this code in a few weeks/months and you will thank me in the end. – RiggsFolly Aug 29 '21 at 18:56
  • which of the two requests is giving the 400 error? – apokryfos Aug 29 '21 at 21:25
  • It is the second request. First request gives a 401 error – Vishnu Priyan Sep 02 '21 at 05:02

0 Answers0