Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use NTLM authentication with Axios

Tags:

reactjs

axios

I have a WebApi that uses NTLM authentication and I am trying to write a simple React UI to get data from the API but getting 401.

axios.get('url').then(response => console.log(response));

How can I pass my Windows credentials along with the get request?

Thanks

like image 701
Anand Avatar asked Nov 18 '22 06:11

Anand


1 Answers

Axios provides a withCredentials property on request. This is false by default, set it to true and you should be good to go.

Axios.get('url', {
withCredentials: true } )
like image 79
Scornwell Avatar answered Jun 20 '23 00:06

Scornwell