How to assign basic authentication header to XMLHTTPREQUEST?

前端 未结 4 765
闹比i
闹比i 2020-12-14 02:05

I\'ve read many answers of preflight and CORS so please do not post links referencing what I should read. Many of the answers are from a server-perspective, but I am the cli

4条回答
  •  一向
    一向 (楼主)
    2020-12-14 02:16

    If you want to set the authorization header

    req.setRequestHeader('Authorization','Basic ' + Base64StringOfUserColonPassword);
    

提交回复
热议问题