0

I need to auto login on my React App. To do this, I use NTLM authentication. Both , API (php coded) and React App are on an IIS server. I use axios for API calls. When I do GET request, all is right, crendentials are successfully sent (but I must disable anonymous login on IIS). When I use POST query, it fails with 401 error.

I tried several headers but nothing works. That's why I need help. Image : Nothing weird in headers

When I do GET, I see cookie sent, not with my post query

 axios.post(apiUrl+'deleteUserReportFolder.php', {
            reportFolder: e.target.value,
            id: user.login
        },{
        withCredentials: true,
        credentials: 'include',
        headers: {
            'Content-Type': "application/json",
            'Authorization': 'NTLM',
            'WWW-Authenticate': 'NTLM'

        }
        
    })

The API Site is sending these HTTP Response Headers: Image : IIS API Thanks for your help. I've seen a lot of posts but nothing worked.

Edit : I tried by setting my server (API PHP) with anonymous and Windows login, anonymous login cause no logon user, so I must set Windows enabled only. I tried by removing all headers except "withCredentials" in axios query. I still have 401 error on CORS Pre Flight.

Jej
  • 1
  • 2
  • https://stackoverflow.com/questions/18666651 Look at the reply to this question, and you have similar questions – OnePersonLess Jun 25 '21 at 10:06
  • This solution doesn't apply here, I don't have password. I don't use Basic authentication, I use NTLM (I want to use windows login). – Jej Jun 25 '21 at 20:58
  • You can try to use failed request tracking to view detailed error information. – samwu Jun 28 '21 at 09:44
  • @samwu I see same headers as Chrome. No authorization Line. I see "Authentication : NOT AVAILABLE" – Jej Jun 28 '21 at 15:42
  • This should be a cors issue, you can refer to this answer: [https://stackoverflow.com/a/43881141/13336642](https://stackoverflow.com/a/43881141/13336642). – samwu Jun 29 '21 at 09:07

1 Answers1

0
var_dump($_POST);

Check this code,May be it's helpful!

  • Good idea but how can I see the result ? The server send 401 before accessing php script. – Jej Jun 25 '21 at 09:56