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

Sign in via command line #12768

Closed
hamzahamidi opened this issue Apr 24, 2018 · 5 comments
Closed

Sign in via command line #12768

hamzahamidi opened this issue Apr 24, 2018 · 5 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@hamzahamidi
Copy link

hamzahamidi commented Apr 24, 2018

I'm trying to sign via command line to the token_auth but can't seem to work. I always get the piwik.token_auth = "anonymous";
This is my script:

printf "%bGet form_nonce...%b\n" "${YELLOW}" "${STD}"
curl POST "https://piwik.platform/index.php" >nonce.log
NONCE=$(grep -m 1 "form_nonce" nonce.log |sed -e 's/.*value="//'|sed -e 's/"\/>//')
printf "${NONCE}"
curl -v -D headr.log POST "https://piwik.platform/index.php" -d "form_login=login&form_password=password&form_nonce=${NONCE}" >sign-in.log

Any idea on what could be the problem?

@fdellwing
Copy link
Contributor

fdellwing commented Apr 24, 2018

I think you missunderstood how token_auth is working:

curl "https://demo.matomo.org/?module=API&method=UsersManager.getTokenAuth&userLogin=test&md5Password=d8e8fca2dc0f896fd7cb4cb0031ba249&format=original"

Returns an valid token_auth that you can use afterwards.

See https://developer.matomo.org/api-reference/reporting-api#UsersManager for an overview about all methods.

@hamzahamidi
Copy link
Author

@fdellwing But isn't it weird that the token changes when you refresh the page?

@sgiehl
Copy link
Member

sgiehl commented Apr 24, 2018

That shouldn't be the case for valid userLogin / md5Password combinations

@hamzahamidi
Copy link
Author

@sgiehl @fdellwing Thank you, it worked.

@tsteur
Copy link
Member

tsteur commented Apr 24, 2018

BTW: For general questions please ask in the Platform forum as we usually don't answer questions here: https://forum.matomo.org/c/plugins-platform

@mattab mattab added the answered For when a question was asked and we referred to forum or answered it. label May 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

5 participants