Fix authentication to behave correctly under node.js. Update readme with info on node.js.