OAuth2\OAuth2::grantAccessTokenUserCredentials PHP Method

grantAccessTokenUserCredentials() protected method

protected grantAccessTokenUserCredentials ( OAuth2\Model\IOAuth2Client $client, array $input ) : array | boolean
$client OAuth2\Model\IOAuth2Client
$input array
return array | boolean
    protected function grantAccessTokenUserCredentials(IOAuth2Client $client, array $input)
    {
        if (!$this->storage instanceof IOAuth2GrantUser) {
            throw new OAuth2ServerException(self::HTTP_BAD_REQUEST, self::ERROR_UNSUPPORTED_GRANT_TYPE);
        }
        if (!$input["username"] || !$input["password"]) {
            throw new OAuth2ServerException(self::HTTP_BAD_REQUEST, self::ERROR_INVALID_REQUEST, 'Missing parameters. "username" and "password" required');
        }
        $stored = $this->storage->checkUserCredentials($client, $input["username"], $input["password"]);
        if ($stored === false) {
            throw new OAuth2ServerException(self::HTTP_BAD_REQUEST, self::ERROR_INVALID_GRANT, "Invalid username and password combination");
        }
        return $stored;
    }