XF 2.1 Google OAuth stopped working all of a sudden. "An error occurred while connecting with Google. Please try again later."

V3NTUS

Well-known member
A few users reported this issue and I was able to reproduce it, so I'll report it here.

Go to Connected account providers and test Google.

It'll show the following error message:

"An error occurred while connecting with Google. Please try again later."

It worked perfectly for years, and now all of a sudden it's not working anymore for some reason. I tried to go to the Google API page relative to my API to check if there were any errors or if anything changed, but there's no issue reported, so I'm unable to fix this issue. Is anyone else experiencing this problem?

I tried with different browser (hoping and thinking it was just a cookie-related error), but it isn't, as from Firefox I'm unable to connect to Google as well.

In the hope someone can help, as google (and gmail) are one of the main providers nowadays and more and more users are reporting this issue, being unable to login.
 
Seems to be working fine here:

1574328154022.webp

This indicates it isn't a general issue, so would require more troubleshooting.

Would be recommended to check if there are any associated server error logs.
 
Thank you so much for caring dear Chris D. Unfortunately no server error logs. Would it be possible, by editing the "connected_accounts.php" file, to display the exact error originated by google as response? Maybe it should explain better the real issue rather than a generic "An error occurred while connecting with Google. Please try again later."?
 
I suspect the error is actually coming from src/XF/ConnectedAccount/Provider/AbstractProvider.php.

If I'm in the right place then if you edit that file and find:
PHP:
if (!($e instanceof HttpResponseException))

Directly above it add:
PHP:
throw $e;

Then try again.
 
Thanks a lot.

It shows:

"An unexpected error occurred. Please try again later. "

But it also (finally) logs the following error:

Code:
[LIST]
[*]GuzzleHttp\Exception\RequestException: cURL error 56: OpenSSL SSL_read: Success (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
[*]src/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:186
[*]Generated by: Unknown account
[*]Nov 21, 2019 at 10:52 AM
[/LIST]
Stack trace
#0 src/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(149): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array)
#1 src/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(102): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#2 src/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#3 src/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#4 src/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(51): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#5 src/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(66): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#6 src/vendor/guzzlehttp/guzzle/src/Middleware.php(30): GuzzleHttp\PrepareBodyMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#7 src/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php(70): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#8 src/vendor/guzzlehttp/guzzle/src/Middleware.php(58): GuzzleHttp\RedirectMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#9 src/vendor/guzzlehttp/guzzle/src/HandlerStack.php(67): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#10 src/vendor/guzzlehttp/guzzle/src/Client.php(277): GuzzleHttp\HandlerStack->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#11 src/vendor/guzzlehttp/guzzle/src/Client.php(125): GuzzleHttp\Client->transfer(Object(GuzzleHttp\Psr7\Request), Array)
#12 src/vendor/guzzlehttp/guzzle/src/Client.php(131): GuzzleHttp\Client->requestAsync('POST', Object(GuzzleHttp\Psr7\Uri), Array)
#13 src/XF/ConnectedAccount/Http/Client.php(51): GuzzleHttp\Client->request('POST', 'https://account...', Array)
#14 src/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/AbstractService.php(124): XF\ConnectedAccount\Http\Client->retrieveResponse(Object(OAuth\Common\Http\Uri\Uri), Array, Array)
#15 src/XF/ConnectedAccount/Provider/AbstractProvider.php(220): OAuth\OAuth2\Service\AbstractService->requestAccessToken('4/tgFw7eajmOlKo...')
#16 connected_account.php(59): XF\ConnectedAccount\Provider\AbstractProvider->requestProviderToken(Object(XF\ConnectedAccount\Storage\StorageState), Object(XF\Http\Request), Object(XF\Phrase), false)
#17 {main}
Request state
array(4) {

}
["_POST"] => array(0) {
}
}
 
Last edited by a moderator:
Yeah sorry, I should have said, that's what I expected - the error to be logged rather than displayed.

You can undo that code change now if you wish.

There doesn't seem to be anything conclusive here other than it's related to cURL and OpenSSL. I'm not sure I understand "OpenSSL SSL_read: Success" but apparently cURL error 56 means Failure with receiving network data..

This does indicate something specific to your server.

Taking the error Failure with receiving network data. at face-value, it may well be indicative of a proxy or firewall issue.

Other than that, if you're able to, you may want to see if there are any paths available through your server/hosting which would allow you to rebuild/upgrade to a newer version of cURL and/or OpenSSL. I have known cURL bugs in the past cause unexpected issues and updating it sometimes fixes them.
 
I have root access to the server being a dedicated server. I remember recently updating OpenSSL a few weeks ago, unsure if it might help, I'll post below their versions:

curl 7.19.7
OpenSSL 1.1.0f 25 May 2017
 
Last edited:
I wouldn’t know if those specific versions have any particular issue.

It may be worth seeing if you can update further as those aren’t particularly recent versions. Though the message about failing to receive network data may be worth exploring further too.
 
Thanks Chris D. I'm trying to find out how to update curl as I'm on WHM & cPanel and their curl version is based on the OS curl version itself.

I'll update you if I'll have some news, hopefully I can get this solved asap, hope you understand my concerns.
 
Top Bottom