Leantime/leantime · error · Illuminate\Validation\UnauthorizedException

You are not authorized to access this resource.

Error message

You are not authorized to access this resource.

What it means

Error "You are not authorized to access this resource." thrown in Leantime/leantime.

Source

Thrown at app/Domain/Auth/Services/AccessToken.php:123

        return $this;
    }

    public function save()
    {
        return true;
    }

    public function getUserTokens(int $userId)
    {

        if (Auth::userIsAtLeast(Roles::$admin) || $userId == session('userdata.id')) {

            return $this->tokenRepo->getAllTokensByUserId($userId) ?? [];

        } else {

            throw new UnauthorizedException('You are not authorized to access this resource.');
        }
    }

    public function getTokenById($tokenId)
    {
        return $this->tokenRepo->findTokenById($tokenId);
    }

    public function deleteToken(int $tokenId)
    {

        $token = $this->getTokenById($tokenId);

        if (Auth::userIsAtLeast(Roles::$admin) || $token['tokenable_id'] == session('userdata.id')) {

            return $this->tokenRepo->deleteToken($tokenId);

        } else {

View on GitHub (pinned to 9a9f49f100)

When it happens

Trigger: Thrown at app/Domain/Auth/Services/AccessToken.php:123 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Leantime/leantime@9a9f49f100 (2026-08-21). Data as JSON: /api/errors/e9dea9bdae1cc821. Report an issue: GitHub.