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

GoogleClient does not decode gzip encoded response from authorization server #18

Open
dospromptman opened this issue Mar 7, 2015 · 2 comments

Comments

@dospromptman
Copy link

On line 52 of ReverseOAuth2/Client/Google.php, the call to getContent() returns the raw content of the response message.

If the response message has some kind of encoding (i.e. gzip or some other encoding specified by Content-Encoding or Transfer-Encoding headers), then this content is NOT decoded and the raw encoded bytes will be returned.

If the content is gzipped (for example), this will cause the JSON decoding to fail.

Using the getBody() method of Zend\Http\Response, instead of getContent(), will properly decode the body.

This issue probably exists in other clients, too.

Note: I am seeing this issue when using the Google client to authenticate with Salesforce (they use the same parameter names-- I override the endpoints via config), which returns plaintext JSON responses in most cases, but a gzipped encoded JSON response when exchanging an authorization_code.

@denchik63
Copy link

I have the same problem with Facebook. getContent return somthing like that "�Л�\000\000\000\000\000\000� ОKrГ \000@o╙╡Кh║╚�0��QLЪi╙A�╤┌�?Ш▒Ю╛�р}ДФjЪ╛э│SfO�"т�8�;>Fщеу�\000°{aъЬwyQ▄8в├╡Ь╩Qv╗┘ЦЬ�Q╟ззfьс�яея�ЩШх╒оЩП╛8�їа9n╬#╟B�:;�/╔ZїяM6�╓л�┌╤)э{ы█╡А┼_┘VkФ╫щуЎВБLдЫ%z[�R�9�л�амШ[ЛЕbsсщ╦�[N6√ч╕Х�ОMl@v╖��╕X>ъС�Кx─г7╡Їэиж=tC▀�ю?S��УЎ\000\000\000" But if use getBody i have "access_token=CAACaX60aB04BAJUkZC335lUYeSLkLNNdZAPqXOsOrck8utOZCnabHRofYYm132vfgZAnHYLQ8huM4aEMfqfZBhSrZBae3Pu0ZBxIzQp9hKuqt2bIPkPsJppt4tzN5NyOiQzDLbJmdv56cIc1KIfZC36J4A00ZBfj5cQY1baxPBnEY7RW27iZCrZBTrgZA6ZBnHn3Kgtc56BNxFbrZCPAZDZX&expires=5174231"

@conyg
Copy link

conyg commented Apr 22, 2016

I run into this issue myself.
Indeed getContent() should be replaced by getBody() on all clients!

Silvester can you please update sources? And check the demo pages also!

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

3 participants