Why doesn't cURL work with Windows Authentication on IIS7?

前端 未结 4 1299
春和景丽
春和景丽 2021-01-31 08:44

I am trying to access a service that is behind Windows Authentication. I thought I could pass the credentials the way HTTP Basic Authentication credentials are passed, but it\'s

4条回答
  •  Happy的楠姐
    2021-01-31 09:40

    I just want to add that authorization might include several redirects and the NTLM authentication might be required for the second or subsequent requests, but not the first one. In this case the answers here won't work.

    The thing is, CURL sends credentials with the first request only, while you might need them for the second one for example. To pass credentials with all the requests, use the --location-trusted option.

    From CURL documentation (-L option):

    When authentication is used, curl only sends its credentials to the initial host. If a redirect takes curl to a different host, it won't be able to intercept the user+password. See also --location-trusted on how to change this.

    This important note helped me authorize on my company website. Hope that helps somebody else.

提交回复
热议问题