简体   繁体   English

使用请求模块通过同一URL的2个基本身份验证级别

[英]pass through 2 Basic Authentication levels for the same URL using request module

I have a web service that uses request module nodejs to get into another service in php protected by basic authentication, using below code, everything was working as expected 我有一个使用请求模块nodejs进入受基本身份验证保护的php中的另一个服务的Web服务,使用下面的代码,一切都按预期工作

request.get(url).auth(cred.username, cred.password, false);

we recently implemented another level of basic authentication on the web server level for different purposes, now I have 2 levels of authentication, I tried to duplicate this request command by doing 我们最近出于不同的目的在Web服务器级别上实现了另一级别的基本身份验证,现在我有2个级别的身份验证,我尝试通过执行以下操作来复制此请求命令

request.get(url).auth(cred.username01, cred.password01, false);
request.get(url).auth(cred.username02, cred.password02, false);

this did not work, anyone had similar issue before, any help ? 这没有用,以前有人遇到过类似问题,有帮助吗?

Javascript是异步的,您将需要在第一个回调中执行第二个get请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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