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

Can't get auth token from the Piwik API (v3) for a specific user / newly created user #11159

Closed
davorminchorov opened this issue Jan 9, 2017 · 6 comments
Labels
answered For when a question was asked and we referred to forum or answered it. c: New plugin For features that probably will not be added to Matomo, but could be implemented as plugins.

Comments

@davorminchorov
Copy link

Hi there!

After upgrading Piwik to v3, the removal of auth tokens from the list of users / specific user / newly created user broke my application, so I fixed it but now I can't get the auth token using the Piwik API in order to log the users in using an iframe.

I use the getTokenAuth() method but that causes a new error when trying to log in the user using that auth token, and the error Error: You can't access this resource as it requires an 'view' access for the website id = 91. shows up. The weird part is that the site id 91 has view access already when I run the getSitesAccessFromUser() method to check the access of all sites (in my case, the user has one site).

I've read about this problem on the forums and #10938 but can't find a solution.

Any ideas how can I get the auth token through the Piwik API? I don't have access to the Piwik Database.

@Fensterbank
Copy link
Contributor

Hey,

we have the same issue!
I thought, still getting the token in v3 would be easy to solve by just using the getTokenAuth() method, but as mentioned in the forum post this doesn't work because the method does not accept the encrypted password we're getting from the other api methods.

I don't want to take a look directly to the database for this because using an (available) API is always better.

Because our scripted workflow is broken now, our company decided to downgrade back to 2.17.1 until there is a solution for this. :(

@mattab mattab added the Regression Indicates a feature used to work in a certain way but it no longer does even though it should. label Feb 18, 2017
@mattab
Copy link
Member

mattab commented Feb 18, 2017

Thanks for the report. This is indeed a problem if you need the token_auth. So far we think the best way to provide a workaround would be to create a new plugin on the marketplace, which would add the token_auth to all API methods exporting users information. Would maybe one of you be able to create this plugin?

@tsteur
Copy link
Member

tsteur commented Feb 18, 2017

This is not a regression since the API is still the same and still works see eg in the mobile app etc.

but as mentioned in the forum post this doesn't work because the method does not accept the encrypted password we're getting from the other api methods.

There is no way anymore to get the original password from the database since it is hashed. You need the original password to get the token

@mattab mattab removed the Regression Indicates a feature used to work in a certain way but it no longer does even though it should. label Feb 18, 2017
@mattab mattab added this to the Backlog (Help wanted) milestone Feb 20, 2017
@mattab mattab added the c: New plugin For features that probably will not be added to Matomo, but could be implemented as plugins. label Feb 20, 2017
@mattab
Copy link
Member

mattab commented Mar 27, 2017

Maybe App-specific passwords could help with this use case? we'll discuss this possibility in #6559 (comment)

@sgiehl
Copy link
Member

sgiehl commented Jul 23, 2020

I'll close this issue now, as it won't be possible in any way to receive the auth tokens as of Matomo 4. If you need to automate anything you can create app specific tokens for a user or temporary system token to use them in external applications.

@sgiehl sgiehl closed this as completed Jul 23, 2020
@mattab
Copy link
Member

mattab commented Sep 10, 2020

the solution is documented in the FAQ at https://matomo.org/faq/general/faq_114/ including how it will work for Matomo 4 and newer

@mattab mattab added the answered For when a question was asked and we referred to forum or answered it. label Sep 28, 2020
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. c: New plugin For features that probably will not be added to Matomo, but could be implemented as plugins.
Projects
None yet
Development

No branches or pull requests

5 participants