简体   繁体   中英

How to set http header 'www-authenticate' for proxy authentication in .js

I am getting error: http header 'www-authenticate' used for proxy authentication not found, while running.js script. I have tried many ways to set proxy authentication but it's giving syntax error everytime. Following is my code and commented lines are the ones that I have tried (but not working):

var url = someURL; var result;

var request = new HttpClientRequest(url);
//request.header("Authorization", "Bearer token")
//WWW-Authenticate: Bearer token
request.method="GET";
//request.header('WWW-Authenticate: Bearer token realm="My Realm"');
request.header["Content-Type"] = "text/xml; charset=utf-8";
//request.header["WWW-Authenticate"] = "Bearer token";

I figured out the answer. Authentication header can be set as follows: request.header["Authorization"] = "Bearer token";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM