8000 Problem on AWS · Issue #4 · jaredhanson/passport-google · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Problem on AWS #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tjerabek opened this issue Nov 19, 2012 · 3 comments
Open

Problem on AWS #4

tjerabek opened this issue Nov 19, 2012 · 3 comments

Comments

@tjerabek
Copy link

my application don't work on AWS with passport and Google strategy. This is error:

node_modules/passport-google/node_modules/passport-openid/node_modules/openid/lib/convert.js:33
if(i.charCodeAt(0) > 127)
^
TypeError: Object ��:
�9r���Ţ�17q~��q�v#sf��Z.'�����zc�?)XӲ�9��h7W}E���-�zv�ΧKH�߯���%�NE��f4�I��5̂�H;�v">]I
����"� has no method 'charCodeAt'
at Object.btwoc (/home/ec2-user/data/scrum/node_modules/passport-google/node_modules/passport-openid/node_modules/openid/lib/convert.js:33:8)
at _toBase64 (/home/ec2-user/data/scrum/node_modules/passport-google/node_modules/passport-openid/node_modules/openid/openid.js:70:40)
at Object.openid.associate (/home/ec2-user/data/scrum/node_modules/passport-google/node_modules/passport-openid/node_modules/openid/openid.js:637:35)
at successOrNext (/home/ec2-user/data/scrum/node_modules/passport-google/node_modules/passport-openid/node_modules/openid/openid.js:844:16)
at /home/ec2-user/data/scrum/node_modules/passport-google/node_modules/passport-openid/node_modules/openid/openid.js:860:5
at /home/ec2-user/data/scrum/node_modules/passport-google/node_modules/passport-openid/node_modules/openid/openid.js:607:7
at /home/ec2-user/data/scrum/node_modules/passport-google/node_modules/passport-openid/node_modules/openid/openid.js:485:16
at done (/home/ec2-user/data/scrum/node_modules/passport-google/node_modules/passport-openid/node_modules/openid/openid.js:201:9)
at IncomingMessage. (/home/ec2-user/data/scrum/node_modules/passport-google/node_modules/passport-openid/node_modules/openid/openid.js:205:32)
at IncomingMessage.EventEmitter.emit (events.js:123:20)

Everything is ok on my local computer.

@writeopen
Copy link

I've experienced the same problem, and I've noticed that Node 0.8.15 works fine but Node 0.9 breaks (same stack trace).

Maybe don't use the non-stable version? (lol, me too).

@tbeseda
Copy link
tbeseda commented Mar 15, 2013

Same issue here. Not ready to upgrade to Oauth2 / https://github.com/jaredhanson/passport-google-oauth
Will continue using 0.8.x

@metormote
Copy link

It seems like the crypto module in node returns buffer objects instead of binary strings as default since version 0.9.0.

This diff will fix the problem:

diff --git node_modules/passport-google/node_modules/passport-openid/node_modules/openid/openid.js node_modules/passport-google/node_modules/passport-openid/node_modules/openid/openid.js
index 1431dd7..798f741 100644
--- node_modules/passport-google/node_modules/passport-openid/node_modules/openid/openid.js
+++ node_modules/passport-google/node_modules/passport-openid/node_modules/openid/openid.js
@@ -634,9 +634,9 @@ openid.associate = function(provider, callback, strict, algorithm)
   if(algorithm.indexOf('no-encryption') === -1)
   {
     dh = _createDiffieHellmanKeyExchange(algorithm);
-    params['openid.dh_modulus'] = _toBase64(dh.getPrime());
-    params['openid.dh_gen'] = _toBase64(dh.getGenerator());
-    params['openid.dh_consumer_public'] = _toBase64(dh.getPublicKey());
+    params['openid.dh_modulus'] = _toBase64(dh.getPrime("binary"));
+    params['openid.dh_gen'] = _toBase64(dh.getGenerator("binary"));
+    params['openid.dh_consumer_public'] = _toBase64(dh.getPublicKey("binary"));
   }

   _post(provider.endpoint, params, function(data, h
69D5
eaders, statusCode)
@@ -713,10 +713,10 @@ openid.associate = function(provider, callback, strict, algorithm)
       else
       {
         var serverPublic = _fromBase64(data.dh_server_public);
-        var sharedSecret = convert.btwoc(dh.computeSecret(serverPublic));
+        var sharedSecret = convert.btwoc(dh.computeSecret(serverPublic, "binary", "binary"));
         var hash = crypto.createHash(hashAlgorithm);
         hash.update(sharedSecret);
-        sharedSecret = hash.digest();
+        sharedSecret = hash.digest("binary");
         var encMacKey = convert.base64.decode(data.enc_mac_key);
         secret = convert.base64.encode(_xor(encMacKey, sharedSecret));
       }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
0