Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentnication token expires after 2 days and import fails thereafter. #326

Open
dgaastra opened this issue Nov 30, 2021 · 3 comments
Open

Comments

@dgaastra
Copy link

Dear Matomo!

Thanks for making such a great tool. We exclusively use the log importer and cannot use any live trackers due to performance and GDPR matters:

Problem: after having started the log importer as a daemon, it stops working after 48 hours...

Startup:
[DEBUG] No token-auth specified
[DEBUG] No credentials specified, reading them from "/usr/share/matomo/config/config.ini.php"
[DEBUG] Authentication token token_auth is: 2b63873d2d3a6afa6a49355f96ac2b3d

A token file token.php is correctly created in /matomo/tmp/cache/

Failure after 48 hours:

[INFO] The Matomo tracker identified 57 invalid requests.
[INFO] The Matomo tracker identified 57 invalid requests.
...

The Web-GUI shows:
Request was not authenticated but authentication was required. Set or correct a "token_auth" in your tracking request. Learn more

How can we make it work indefinitely?

Thanks
Dennis.

@sgiehl
Copy link
Member

sgiehl commented Dec 2, 2021

Hi @dgaastra,
The token created when starting the script is indeed only valid for 48 hours. If you want to run the script longer, you can simply create a app specific token manually for the super user within the Matomo UI. This can then be used with the log importer by providing it as parameter --token-auth=XXX

@dgaastra
Copy link
Author

dgaastra commented Dec 2, 2021

To stay independent of the GUI, and clean, would it be possible to have a parameter --token-duration=indefinitely ?

@sgiehl
Copy link
Member

sgiehl commented Dec 3, 2021

Sure, that would be possible. But we currently don't have the capacity to implement that soon. If you have some time left, feel free to create a PR for that. The token lifetime is actually set here:

api_result = matomo.call_api('UsersManager.createAppSpecificTokenAuth',
userLogin=matomo_login,
passwordConfirmation=matomo_password,
description='Log importer',
expireHours='48',
_token_auth='',
_url=self.options.matomo_api_url,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants