0

I'm using node.js with the request.js module to make authenticated https requests like so.

username = req.body.username;
password = req.body.password;
var url = 'https://' + username + ':' + password + '@domain.com';
request({
    url : url,
}, function (error, response, body){
  //do something here
});

Is there another way to do this without having the node.js server make this call without exposing the password in plain text?

For example, say I went to http://domain.com and logged in with my credentials. I can then close my browser, revisit http://domain.com and be automagically logged in. Can I then visit my node.js app (localhost:3000) and make subsequent requests using the node app without explicitly reentering my password?

4

1 に答える 1

0

いいえ、ブラウザの Cookie を使用してノードにログインすることはできません。ただし、次のようなノードで認証できます:基本認証がある場合に Node.js で http.client を使用する方法

于 2013-03-07T04:57:16.457 に答える