{"record":{"id":"e9dea9bdae1cc821","repo":"Leantime/leantime","slug":"you-are-not-authorized-to-access-this-resource","errorCode":null,"errorMessage":"You are not authorized to access this resource.","messagePattern":"You are not authorized to access this resource\\.","errorType":"exception","errorClass":"Illuminate\\Validation\\UnauthorizedException","httpStatus":null,"severity":"error","filePath":"app/Domain/Auth/Services/AccessToken.php","lineNumber":123,"sourceCode":"\n        return $this;\n    }\n\n    public function save()\n    {\n        return true;\n    }\n\n    public function getUserTokens(int $userId)\n    {\n\n        if (Auth::userIsAtLeast(Roles::$admin) || $userId == session('userdata.id')) {\n\n            return $this->tokenRepo->getAllTokensByUserId($userId) ?? [];\n\n        } else {\n\n            throw new UnauthorizedException('You are not authorized to access this resource.');\n        }\n    }\n\n    public function getTokenById($tokenId)\n    {\n        return $this->tokenRepo->findTokenById($tokenId);\n    }\n\n    public function deleteToken(int $tokenId)\n    {\n\n        $token = $this->getTokenById($tokenId);\n\n        if (Auth::userIsAtLeast(Roles::$admin) || $token['tokenable_id'] == session('userdata.id')) {\n\n            return $this->tokenRepo->deleteToken($tokenId);\n\n        } else {","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/Leantime/leantime/blob/9a9f49f1008f4782b30f6723c54228f4f992e636/app/Domain/Auth/Services/AccessToken.php#L105-L141","documentation":"Error \"You are not authorized to access this resource.\" thrown in Leantime/leantime.","triggerScenarios":"Thrown at app/Domain/Auth/Services/AccessToken.php:123 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9a9f49f1008f4782b30f6723c54228f4f992e636","analyzedAt":"2026-08-21T02:37:38.966Z","schemaVersion":2},"datasetVersion":"2026-08-21T03:17:12.404Z"}