Nodejs https request for oauth2 token (google, facebook) produce error 'socket hang up'
I'm developing nodejs oauth2 npm module: https://github.com/lexer/node-oauth2
When Im trying to make https request to google or facebook i get:
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: socket hang up
at Socket.<anonymous> (http.js:1272:45)
at Socket.emit (events.js:64:17)
at Array.<anonymous>开发者_运维问答; (net.js:825:12)
at EventEmitter._tickCallback (node.js:126:26)
You can reproduce bug in express sample application that i've made:
https://github.com/lexer/node-oauth2/tree/master/examples/express
Have fixed the issue. Instead of http.ClientRequest with secure option "true" im using https.request method now.
精彩评论