Skip to content

OAuth URL generation issue when reverse proxy from HTTP to HTTPS #98

@ArlindoFNeto

Description

@ArlindoFNeto

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! :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneed feedbackNeed feedback

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions