Error on Google login
-
Redirecting to Google login fails with an exception:
Error: invalid_request Required parameter is missing: response_type
The redirect URL generated by WordPress Social Login looks like this:
https://accounts.google.com/o/oauth2/auth?client_id=<my id>.apps.googleusercontent.com&redirect_uri=<my domain>%2Fwp-content%2Fplugins%2Fwordpress-social-login%2Fhybridauth%2F%3Fhauth.done%3DGoogle&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&access_type=offline
Due to HTML-escaped ampersands in the URL, the URL params won’t get submitted properly. Replacing all occurences of escaped ampersands by a simple & fixes the problem and the Google login screen appears.
I tracked it down to the file, where the URL is put together, which is /hybridauth/Hybrid/thirdparty/OAuth/OAuth2Client.php.In line 64, I changed
return $this->authorize_url . "?" . http_build_query( $params );
to
return $this->authorize_url . "?" . http_build_query( $params, '', '&' );
and that fixed it. I think, it might be related to the behaviour described here: https://www.php.net/manual/de/function.http-build-query.php#102324Could you check, whether this is alright and apply it to one of the next plugin releases?
Thanks in advance
https://www.ads-software.com/plugins/wordpress-social-login/
- The topic ‘Error on Google login’ is closed to new replies.