Optional userLogin in getUserPreference API #16010
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Needed this for matomo-org/matomo-mobile-2#5406
We're now allowing users to log in using their token auth. This way for example people using
can also use the mobile app. It basically looks like this:
Because the user is no longer logging in with username/password, I no longer have a username to pass to the
getUserPreference
method. We call this API in the mobile app to find out which site to load by default and which date to show by default.There was no API method to get the userLogin for an auth token. Could have added such an API but that would mean we always have two API calls when instead the method could simply default to the current user log in.
Adding this to 3.X since the same Matomo mobile app will be used for Matomo 3 and Matomo 4 and by making this work in the latest 3.X we will have less issues with users trying to log in using token auth. This way we also don't need to wait for months to release this new update as people will be able to use it right away. (if they use a recent Matomo version)