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

Fatal error in trying to get the user's profile image #8

Open
stevevance opened this issue Jan 28, 2019 · 2 comments
Open

Fatal error in trying to get the user's profile image #8

stevevance opened this issue Jan 28, 2019 · 2 comments

Comments

@stevevance
Copy link

stevevance commented Jan 28, 2019

Hi, I updated to 2.0.5, and after I agree with Yahoo! to use my Yahoo! account, I am redirected back to my site, and then this error occurs:

PHP Fatal error:  Uncaught Error: Cannot use object of type GuzzleHttp\Psr7\Response as array in /website/vendor/hayageek/oauth2-yahoo/src/Provider/Yahoo.php:122
Stack trace:
#0 /website/vendor/hayageek/oauth2-yahoo/src/Provider/Yahoo.php(105): Hayageek\OAuth2\Client\Provider\Yahoo->getUserImageUrl(Array, Object(League\OAuth2\Client\Token\AccessToken))
#1 /website/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(754): Hayageek\OAuth2\Client\Provider\Yahoo->createResourceOwner(Array, Object(League\OAuth2\Client\Token\AccessToken))
#2 /website/account.php(116): League\OAuth2\Client\Provider\AbstractProvider->getResourceOwner(Object(League\OAuth2\Client\Token\AccessToken))
#3 {main}
  thrown in /website/vendor/hayageek/oauth2-yahoo/src/Provider/Yahoo.php on line 122

In the meantime, since I don't need the image URL, I commented out lines 122-126 of vendor/hayageek/oauth2-yahoo/src/Provider/Yahoo.php.

/*
        if (isset($image['image']['imageUrl'])) {
            return $image['image']['imageUrl'];
        }
*/
@stevevance
Copy link
Author

I think this is due to a failure in getting/creating a token.

When I print a serialized version of the $token, this is what shows in the PHP error log:
O:38:"League\OAuth2\Client\Token\AccessToken":5:{s:14:"
As you can see the token is cut off.

When I print a serialized version of Yahoo!'s response to requesting the token, there's a problem – the GUID is missing from the URL, prompting this error from Yahoo!:

s:412:"<HTML>
<HEAD>
<TITLE>Error</TITLE>
</HEAD>

<BODY BGCOLOR="white" FGCOLOR="black">
<!-- status code : 404 -->
<!-- Error: GET -->
<!-- host machine: o13.ycpi.bf1.yahoo.com -->
<!-- timestamp: 1548655378.622 -->
<!-- url: https://social.yahooapis.com/v1/user//profile?format=json-->
<H1>Error</H1>
<HR>

<FONT FACE="Helvetica,Arial"><B>
Description: Could not process this "GET" request.
</B></FONT>
<HR>
</BODY>
";

Which then prompts this error from league/oauth2-client:

Invalid response received from Authorization Server. Expected JSON.

@garak
Copy link

garak commented Feb 9, 2021

Same problem here 😞

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

2 participants