Basic HTTP authentication in Node.JS?

The username:password is contained in the Authorization header as a base64-encoded string Try this: http. CreateServer(function(req,res){ var header=req. Headers'authorization'||'', // get the header token=header.

Split(/\s+/).pop()||'', // and the encoded auth token auth=new Buffer(token, 'base64').toString(), // convert from base64 parts=auth. Split(/:/), // split on colon username=parts0, password=parts1; res. WriteHead(200,{'Content-Type':'text/plain'}); res.

End('username is "'+username+'" and password is "'+password+'"'); }). Listen(1337,'127.0.0.1') Detail on http authorization can be found at http://www.ietf.org/rfc/rfc2617.txt.

The username:password is contained in the Authorization header as a base64-encoded string. Try this: http. CreateServer(function(req,res){ var header=req.

Headers'authorization'||'', // get the header token=header. Split(/\s+/).pop()||'', // and the encoded auth token auth=new Buffer(token, 'base64').toString(), // convert from base64 parts=auth. Split(/:/), // split on colon username=parts0, password=parts1; res.

WriteHead(200,{'Content-Type':'text/plain'}); res. End('username is "'+username+'" and password is "'+password+'"'); }). Listen(1337,'127.0.0.1'); Detail on http authorization can be found at http://www.ietf.org/rfc/rfc2617.txt.

You can use node-http-digest for basic auth or everyauth, if adding authorization from external services are in you roadmap.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send