public function authenticateUser($username, $password, $params = [])
{
$defaultParams = ['client_id' => $this->clientId, 'client_secret' => $this->clientSecret, 'grant_type' => 'password', 'username' => $username, 'password' => $password];
if (!empty($this->scope)) {
$defaultParams['scope'] = $this->scope;
}
$request = $this->createRequest()->setMethod('POST')->setUrl($this->tokenUrl)->setData(array_merge($defaultParams, $params));
$response = $this->sendRequest($request);
$token = $this->createToken(['params' => $response]);
$this->setAccessToken($token);
return $token;
}