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

Response formatting problem #231

Open
makcent opened this issue Jun 22, 2018 · 6 comments
Open

Response formatting problem #231

makcent opened this issue Jun 22, 2018 · 6 comments

Comments

@makcent
Copy link

makcent commented Jun 22, 2018

What steps will reproduce the problem?

When using Tencent QQ, the return value is this form callback ({'openid': 1}), so getData () can not parse the data normally.

What's expected?

How can you return to the JSON information in callback

What do you get instead?

yii\httpclient\Exception: Unable to detect format for content parsing. Raw response:

Http-Code: 200
Server: tws
Date: Fri, 22 Jun 2018 01:11:37 GMT
Content-Type: text/html
Content-Length: 83
Connection: close
Cache-Control: no-cache

callback( {"client_id":"101364207","openid":"805CFCB3AFEA40CA7CE4B6D8A8668793"} );

Known solutions:

Reduce the use of the yii2-authclient version [yii\authclient\BaseOAuth:: processResponse ()). The latest version of this method has been removed.

Additional info

Q A
Yii version 2.0.6
Yii Auth Client version 2.1.0
Yii HTTP Client version ~2.0.0
PHP version 7.1
Operating system centos
@yii-bot
Copy link

yii-bot commented Jun 22, 2018

Thanks for posting in our issue tracker.
In order to properly assist you, we need additional information:

  • When does the issue occur?
  • What do you see?
  • What was the expected result?
  • Can you supply us with a stacktrace? (optional)
  • Do you have exact code to reproduce it? Maybe a PHPUnit tests that fails? (optional)

Thanks!

This is an automated comment, triggered by adding the label status:need more info.

@yiisoft yiisoft deleted a comment from yii-bot Jun 24, 2018
@makcent
Copy link
Author

makcent commented Jun 29, 2018

@samdark The authorization information returned by the third party site is this format:
callback( {"client_id":"101364207","openid":"805CFCB3AFEA40CA7CE4B6D8A8668793"} );
The latest version of yii2-authclient is unable to parse this data format normally.
Yii2-authclient:2.0.6 previously supported this method [Yii \ authclient \ BaseOAuth:: processResponse ()] rewriting coverage, but the latest version has been removed

@samdark
Copy link
Member

samdark commented Jun 29, 2018

Callback sounds like jsonp is used. Is that the only way to use Tencent?

@makcent
Copy link
Author

makcent commented Jun 30, 2018

@samdark Yes, the document is described as follows

Step4: use Access Token to get the user's OpenID

  1. send the request to the following address (please replace the access_token isoparametric value with your own):
    Https://graph.qq.com/oauth2.0/me? Access_token=YOUR_ACCESS_TOKEN

  2. get the user OpenID, and the return package is as follows:
    Callback ({"client_id": "YOUR_APPID", "openid": "YOUR_OPENID"});

@samdark
Copy link
Member

samdark commented Jun 30, 2018

Would you please give the link to the documentation?

@makcent
Copy link
Author

makcent commented Jul 3, 2018

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