dominik-th / matomo-plugin-LoginOIDC

external authentication services for matomo
https://plugins.matomo.org/LoginOIDC/
GNU General Public License v3.0
43 stars 31 forks source link

"OAuth state mismatch" error when the user already logged in #97

Open ttphi88 opened 1 year ago

ttphi88 commented 1 year ago

Hello, thank you for developing the plugin. It's excellent and we're happy using it.

However, we've encountered one issue: when the user already has the matomo session, the plugin throws the error.

Steps to reproduce:

My finding:

And the $this->passwordVerify->setPasswordVerifiedCorrectly code is:

        if ($this->enableRedirect) {
            Url::redirectToUrl('index.php' . Url::getCurrentQueryStringWithParametersModified(
                $sessionNamespace->redirectParams
            ));
        }

So the callback action will redirect to itself and throw the error.

One solution (in my opinion) is to check for the login session in the signin action and redirect the user to /index.php. What do you think?

rileyjnevins commented 1 year ago

I am encountering the same issue.

sschueller commented 9 months ago

I can confirm, I see the same issue on my setup.