I’m trying to migrate a Matomo installation to an OpenShift deployment. I first tried a fresh matomo installation and worked nicely. Then I restores the DB from the old installtion into the new one and then tried to log in using the old password. Everything seems to work ok (no errors in console / logs) but the redirect sends me back to the login/password page.
looking at the network traffic I see the 302 POST to index.php?module=Login and then a 200 back to index.php.
Funny enough, if I renebale the LoginOIDC plugin I can access with my SSO….
Somehow the error is related to the Login plugin and/or the admin (root) account.
Nice find, that narrows it down a lot. If SSO logs you in and you stay logged in, then the whole session/cookie side is working fine (storage, cookies, the proxy in front, all good). So the issue is specifically the local username + password login for the admin account, not the sessions.
Two things will tell us exactly what’s happening:
First, in DevTools look at the login POST (the 302) > Response Headers > Location:
if it points to the dashboard (module=CoreHome…), the password was accepted and something kills the session right after
if it points back to Login (or to a 2FA page), the password isn’t being accepted at all
Second, a quick read-only check on the admin row in the database:
SELECT login, LEFT(password,4) AS hash_prefix, ts_password_modified, twofactor_secret FROM matomo_user WHERE superuser_access = 1; – might be piwik_user on the restored dump
if hash_prefix is not $2y$, the restored password hash won’t verify in this Matomo version, which is exactly why SSO works but the local password doesn’t
if twofactor_secret is filled in, 2FA is kicking in on the local login (and SSO bypasses it)
My money is on the password hash. Quickest fix would be to reset the superuser password from the pod CLI and try again.
Shame on me, I did not try the local account after succesfuly log with SSO and, know what? now it also works.
So my conclusion is that if you migrate a matomo instance using SSO you must fully configure SSO on the new instance otherwise local login will not work.