Skip to content
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

'TypeError: Not a Buffer' when redirecting back from Google #5

Open
johnbailon opened this issue Aug 22, 2015 · 14 comments
Open

'TypeError: Not a Buffer' when redirecting back from Google #5

johnbailon opened this issue Aug 22, 2015 · 14 comments

Comments

@johnbailon
Copy link

[email protected]
[email protected]
[email protected]
[email protected]

When app gets the redirect, crashes into this:

crypto.js:356
  return this._handle.verify(toBuf(object), toBuf(signature, sigEncoding));
                      ^
TypeError: Not a buffer
    at TypeError (native)
    at Verify.verify (crypto.js:356:23)
    at GoogleOAuth2.verify (/Users/john/Code/sailsjs/wave/node_modules/waterlock-google-auth/lib/google-oauth2.js:150:19)
    at GoogleOAuth2.decryptRawToken (/Users/john/Code/sailsjs/wave/node_modules/waterlock-google-auth/lib/google-oauth2.js:127:11)
    at GoogleOAuth2._tokenExchangeCallback (/Users/john/Code/sailsjs/wave/node_modules/waterlock-google-auth/lib/google-oauth2.js:92:24)
    at Request.self.callback (/Users/john/Code/sailsjs/wave/node_modules/waterlock-google-auth/node_modules/request/request.js:198:22)
    at Request.emit (events.js:110:17)
    at Request.<anonymous> (/Users/john/Code/sailsjs/wave/node_modules/waterlock-google-auth/node_modules/request/request.js:1073:14)
    at Request.emit (events.js:129:20)
    at IncomingMessage.<anonymous> (/Users/john/Code/sailsjs/wave/node_modules/waterlock-google-auth/node_modules/request/request.js:1019:12)
    at IncomingMessage.emit (events.js:129:20)
    at _stream_readable.js:908:16
    at process._tickDomainCallback (node.js:381:11)
@michalzwolinski
Copy link

+1

@wayne-o
Copy link
Contributor

wayne-o commented Sep 24, 2015

is this still happening?

@innobilehu
Copy link

Yes, I have the same problem:

TypeError: Not a buffer
at Verify.verify (crypto.js:426:24)
at GoogleOAuth2.verify (/home/huygens/kikerdezo/node_modules/waterlock-google-auth/lib/google-oauth2.js:150:19)
at GoogleOAuth2.decryptRawToken (/home/huygens/kikerdezo/node_modules/waterlock-google-auth/lib/google-oauth2.js:127:11)
at GoogleOAuth2._tokenExchangeCallback (/home/huygens/kikerdezo/node_modules/waterlock-google-auth/lib/google-oauth2.js:92:24)
at Request.self.callback (/home/huygens/kikerdezo/node_modules/waterlock-google-auth/node_modules/request/request.js:198:22)
at Request.emit (events.js:98:17)
at Request. (/home/huygens/kikerdezo/node_modules/waterlock-google-auth/node_modules/request/request.js:1063:14)
at Request.emit (events.js:117:20)
at IncomingMessage. (/home/huygens/kikerdezo/node_modules/waterlock-google-auth/node_modules/request/request.js:1009:12)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:929:16
at process._tickDomainCallback (node.js:463:13)

@wayne-o
Copy link
Contributor

wayne-o commented Oct 1, 2015

Can you post some code?
On Thu, 1 Oct 2015 at 16:22, innobilehu [email protected] wrote:

Yes, I have the same problem:

TypeError: Not a buffer
at Verify.verify (crypto.js:426:24)
at GoogleOAuth2.verify
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/lib/google-oauth2.js:150:19)
at GoogleOAuth2.decryptRawToken
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/lib/google-oauth2.js:127:11)
at GoogleOAuth2._tokenExchangeCallback
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/lib/google-oauth2.js:92:24)
at Request.self.callback
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/node_modules/request/request.js:198:22)
at Request.emit (events.js:98:17)
at Request.
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/node_modules/request/request.js:1063:14)
at Request.emit (events.js:117:20)
at IncomingMessage.
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/node_modules/request/request.js:1009:12)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:929:16
at process._tickDomainCallback (node.js:463:13)


Reply to this email directly or view it on GitHub
#5 (comment)
.

@wayne-o
Copy link
Contributor

wayne-o commented Oct 1, 2015

Or a repro project?
On Thu, 1 Oct 2015 at 16:34, Wayne Douglas [email protected] wrote:

Can you post some code?
On Thu, 1 Oct 2015 at 16:22, innobilehu [email protected] wrote:

Yes, I have the same problem:

TypeError: Not a buffer
at Verify.verify (crypto.js:426:24)
at GoogleOAuth2.verify
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/lib/google-oauth2.js:150:19)
at GoogleOAuth2.decryptRawToken
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/lib/google-oauth2.js:127:11)
at GoogleOAuth2._tokenExchangeCallback
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/lib/google-oauth2.js:92:24)
at Request.self.callback
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/node_modules/request/request.js:198:22)
at Request.emit (events.js:98:17)
at Request.
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/node_modules/request/request.js:1063:14)
at Request.emit (events.js:117:20)
at IncomingMessage.
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/node_modules/request/request.js:1009:12)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:929:16
at process._tickDomainCallback (node.js:463:13)


Reply to this email directly or view it on GitHub
#5 (comment)
.

@wayne-o
Copy link
Contributor

wayne-o commented Oct 1, 2015

I think this is to do with a bad response from google that isn't being
handled properly.
On Thu, 1 Oct 2015 at 16:34, Wayne Douglas [email protected] wrote:

Or a repro project?
On Thu, 1 Oct 2015 at 16:34, Wayne Douglas [email protected] wrote:

Can you post some code?
On Thu, 1 Oct 2015 at 16:22, innobilehu [email protected] wrote:

Yes, I have the same problem:

TypeError: Not a buffer
at Verify.verify (crypto.js:426:24)
at GoogleOAuth2.verify
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/lib/google-oauth2.js:150:19)
at GoogleOAuth2.decryptRawToken
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/lib/google-oauth2.js:127:11)
at GoogleOAuth2._tokenExchangeCallback
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/lib/google-oauth2.js:92:24)
at Request.self.callback
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/node_modules/request/request.js:198:22)
at Request.emit (events.js:98:17)
at Request.
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/node_modules/request/request.js:1063:14)
at Request.emit (events.js:117:20)
at IncomingMessage.
(/home/huygens/kikerdezo/node_modules/waterlock-google-auth/node_modules/request/request.js:1009:12)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:929:16
at process._tickDomainCallback (node.js:463:13)


Reply to this email directly or view it on GitHub
#5 (comment)
.

@innobilehu
Copy link

I have in my project nothing special. I installed the waterlock and waterlock-google-auth modules with npm, set the application ID and secret in config file, and tried to login.
How can I debug, or get that bad response?

@EslamMrwan
Copy link

+1

1 similar comment
@a0ali0taha
Copy link

+1

@kurvenschubser
Copy link

I get the same message as above. I patched the decryptRawToken function and got these outputs:

console.log(JSON.stringify(token));
> {"alg":{"alg":"RS256","kid":"e1332da20693e7972849a6679775572a1129c979"},"jwt":{"iss":"https://accounts.google.com","at_hash":"XxGwRsoD6YR4A6X8LBKvyA","aud":"somethingsomething.apps.googleusercontent.com","sub":"111885613732281462399","email_verified":true,"azp":"somethingsomething.apps.googleusercontent.com","email":"[email protected]","iat":1447607531,"exp":1447611131},"signature":"Zv4Gue5oPGh0mkUHdP3bDMCEshnX+uqZaMt/NMkr6quKTlaDefDB2Jxbrr+pzPkkwnXcIHaA+eh4Mmfu5iSjlJ1yqz2lXSc3wqc5D6w2LK+vftKrjiMXiQNmBHihcVc6SDXHtposinIC69A0tS+26mDpHJQSmfJUfh9D8knmHDOR3yLQqZXSaei+AgxzYwyL2xmDQTmRAmyhgrvtb3ylQvBSHdXCAVvB8UDepU/wh9wDNr+3sjnKHq2t22Zom9I2R35CFGUYT5Yabgs1wf/rXA/pAMAnZLi2VBio7ULYzInkY0LHrnYda2Uo9dbsAp6sEO4cXFaDbobYmSPVVgLVxw=="}

console.log(JSON.stringify(cert));
> undefined

console.log(JSON.stringify(this._config.certs));
> {"keys: [{"kty":"RSA","alg":"RS256","use":"sig","kid":"e1332da20693e7972849a6679775572a1129c979","n":"myRvfKi1IYyuSHLTREVBzZD4ZafZ0fry8DQQSqA_95Z9I_yCOJUzA0HULlq-aPJbl4VJ_fa8fdz3ee3YuR1o3VVqA1y3AnQkRRc19h-NVWJr__kvtSUujaSsSJYQRtdsHEiKw8wyCTczXo6ma17iw4RXslD1n91iHseUf7CCO38Hjv7ei_m1QVJ6W-pmumSI0iCcgDwdRgN5VoB8GG64rJ7bhOiLozISoAA8_SVUasFTw8ivahjyAfia45M-JIp5llNMOvNF7SPdpK8BpMu-w6Naa84RgI261YQM3ZjGo3rYvZuCfr-vk48g73tjl5juUftB3WS-MemqKjTfT5BMgw","e":"AQAB"},{"kty":"RSA","alg":"RS256","use":"sig","kid":"87ec10e60929d334bfdae0338f5cb56a5eba0241","n":"wz9NfFTUigQ2P0Ja1PXzeXEeO4vWqXheLT_ocaZ1UilF4L1NfX6f4RX_EPvnsrNK-vI6aUtjwVvH8HW7rMSJGu7PoTHfDktLFf2Q0TYHSUrsa2c9pKjSUMK2emsAQqhenZlknTO5IUyuz9esQNDVOKE_h41nP37-E-tnUuM3vYcdVfUl99-EKrNlbpDLueFc4rw_w9ibG_g3MaCYRXRJKRMhqbQvutwRCMn1A4nEHziN0r90I42hJbBl-pxSyj9TfdPdn9qUjQ0iMF8V1oKMMoL8Zkd2FEii0t40iOukcIVkNM9LP0QpiSBn779kMUsxvIOTY1QCvxAQeDzQQpOVQw","e":"AQAB"}]}

@kurvenschubser
Copy link

So I reinstalled with the current master versions of both waterline and waterline-google-auth. Works now.

@washcyclist
Copy link

@kurvenschubser I've tried reinstalling, and it doesn't seem to fix the issue. Was there anything else you did?

@kurvenschubser
Copy link

No. Reinstalling with npm install git+https://[currentmasterurl] die the trock

@Dransfield
Copy link

Yes, only using the npm install git+https://github.com/waterlock/waterlock-google-auth/
fixed the issue

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

9 participants