Skip to content

Commit

Permalink
- Added new AuthToken function for Matomos V4 api, which is allowing …
Browse files Browse the repository at this point in the history
…multiple auth tokens per user.
  • Loading branch information
swatty007 committed Aug 5, 2021
1 parent 75e3fc9 commit a101e27
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/RobBrazier/Piwik/Module/UsersManagerModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,35 @@
*/
class UsersManagerModule extends Module
{
/**
* Gets the user's Authentication Token for Matomo V4
*
* @param string $userLogin user login
* @param string $password user password
* @param string $description description of the token, e.g. its usage
* @param string $expireDate expire date of the token default: null
* @param int $expireHours expire hours of the token default: 0
* @param null $format override format (defaults to one specified in config file)
*
* @return mixed
*/
public function createAppSpecificTokenAuth($userLogin, $password, $description, $expireDate = '', $expireHours = 0, $format = null)
{
$arguments = [
'userLogin' => $userLogin,
'passwordConfirmation' => $password,
'description' => $description,
'expireDate' => $expireDate,
'expireHours' => $expireHours
];
$options = $this->getOptions($format)
->useSiteId(false)
->usePeriod(false)
->setArguments($arguments);

return $this->request->send($options);
}

/**
* Gets the user's Authentication Token
*
Expand Down

0 comments on commit a101e27

Please sign in to comment.