{"record":{"id":"28f9171e4201fd12","repo":"ruvnet/RuView","slug":"invalid-token","errorCode":null,"errorMessage":"Invalid token","messagePattern":"Invalid token","errorType":"exception","errorClass":"AuthenticationError","httpStatus":401,"severity":"error","filePath":"archive/v1/src/middleware/auth.py","lineNumber":67,"sourceCode":"        to_encode = data.copy()\n        expire = datetime.utcnow() + timedelta(hours=self.expire_hours)\n        to_encode.update({\"exp\": expire, \"iat\": datetime.utcnow()})\n        \n        encoded_jwt = jwt.encode(to_encode, self.secret_key, algorithm=self.algorithm)\n        return encoded_jwt\n    \n    def verify_token(self, token: str) -> Dict[str, Any]:\n        \"\"\"Verify and decode JWT token.\"\"\"\n        try:\n            payload = jwt.decode(token, self.secret_key, algorithms=[self.algorithm])\n            # Check token blacklist (logout invalidation)\n            from src.api.middleware.auth import token_blacklist\n            if token_blacklist.is_blacklisted(token):\n                raise AuthenticationError(\"Token has been revoked\")\n            return payload\n        except JWTError as e:\n            logger.warning(f\"JWT verification failed: {e}\")\n            raise AuthenticationError(\"Invalid token\")\n    \n    def decode_token_claims(self, token: str) -> Optional[Dict[str, Any]]:\n        \"\"\"Decode and verify token, returning its claims.\n\n        Unlike the previous implementation, this method always verifies\n        the token signature.  Use verify_token() for full validation\n        including expiry checks; this helper is provided only for\n        inspecting claims from an already-verified token.\n        \"\"\"\n        try:\n            return jwt.decode(token, self.secret_key, algorithms=[self.algorithm])\n        except JWTError:\n            return None\n\n\nclass UserManager:\n    \"\"\"User management for authentication.\"\"\"\n    ","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/archive/v1/src/middleware/auth.py#L49-L85","documentation":"Error \"Invalid token\" thrown in ruvnet/RuView.","triggerScenarios":"Thrown at archive/v1/src/middleware/auth.py:67 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":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}