Can't log into Matomo

Hi,

I’m having issues with logging into Matomo after editing the config.ini.php file. What I edited was the database information because I imported a backup database into MySQL. That part was successful, editing the config.ini.php file was successful because I got the login page afterwards but it doesn’t recognize my superuser login credentials that I created when I initially setup Matomo. It just says wrong username and password or an error stating the form security failed because of a token mismatch. Has anyone run into this issue?

Hello @wlr13,

You say this started after you edited the config file.

I recommend that you comment out some, or all of that file, except for the top 20 lines or so, where your password is.

Then see if you can log in. And then re-introduce config lines one by one to isolate which line is the problem.

I suspect the setting
force_ssl = 1
would cause a problem, for example, if your https is not set up correctly.

I know some folks might end up here because they are getting the error too:
Error: The form security failed because of a token mismatch. Please reload the form and check that your cookies are on.

Here are general tips:

  1. That error occurs only if the stored token and the submitted one do not match.
  2. Possible reasons could be that the token was already invalidated by another request or storing it in the session failed for any reason.
  3. if cookies are disabled / not allowed that might also happen.
  4. Did you change anything on your Matomo instance. Maybe the apache config was changed or similar. Or it had been https and not it isn’t anymore…

A simple way to check if cookies are on, in your browser, is to go to the dev tools console and execute this, or just look at that object property:

if (navigator.cookieEnabled) {
    console.log("Cookies are enabled.");
} else {
    console.log("Cookies are disabled.");
}

Hi @MisterGenest
:+1:
It could be good to add this check directly in the Matomo code :wink:

You’re right @heurteph-ei .
I made it just now:

Thank you.

2 Likes