When the plugin is used in an HTTP environment that is later converted to HTTPS (e.g. commonly used in container reverse proxies), the generated OAuth URL remains in HTTP, causing the "redirect_uri_mismatch" error. This happens because the method $this->getCurrentURL() returns the current URL as HTTP.
Since Google no longer allows the registration of OAuth URLs using HTTP, this behavior prevents proper integration. To ensure compatibility and security, the plugin should always return the URL as HTTPS.
The proposed solution is to change the file inc/provider.class.php in two places (here and here)
from
'redirect_uri' => $this->getCurrentURL(),
to
redirect_uri' => str_replace("http://", "https://", $this->getCurrentURL()),
Maybe this is not the best fix, but it works for me! :-)
When the plugin is used in an HTTP environment that is later converted to HTTPS (e.g. commonly used in container reverse proxies), the generated OAuth URL remains in HTTP, causing the "redirect_uri_mismatch" error. This happens because the method
$this->getCurrentURL()returns the current URL as HTTP.Since Google no longer allows the registration of OAuth URLs using HTTP, this behavior prevents proper integration. To ensure compatibility and security, the plugin should always return the URL as HTTPS.
The proposed solution is to change the file
inc/provider.class.phpin two places (here and here)from
'redirect_uri' => $this->getCurrentURL(),to
redirect_uri' => str_replace("http://", "https://", $this->getCurrentURL()),Maybe this is not the best fix, but it works for me! :-)