fastapi/full-stack-fastapi-template · error · HTTPException
Inactive user
Error message
Inactive user
What it means
Error "Inactive user" thrown in fastapi/full-stack-fastapi-template.
Source
Thrown at backend/app/api/deps.py:45
TokenDep = Annotated[str, Depends(reusable_oauth2)]
def get_current_user(session: SessionDep, token: TokenDep) -> User:
try:
payload = jwt.decode(
token, settings.SECRET_KEY, algorithms=[security.ALGORITHM]
)
token_data = TokenPayload(**payload)
except InvalidTokenError, ValidationError:
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail="Could not validate credentials",
)
user = session.get(User, token_data.sub)
if not user:
raise HTTPException(status_code=404, detail="User not found")
if not user.is_active:
raise HTTPException(status_code=400, detail="Inactive user")
return user
CurrentUser = Annotated[User, Depends(get_current_user)]
def get_current_active_superuser(current_user: CurrentUser) -> User:
if not current_user.is_superuser:
raise HTTPException(
status_code=403, detail="The user doesn't have enough privileges"
)
return current_user
View on GitHub (pinned to 8063fe54f1)
When it happens
Trigger: Thrown at backend/app/api/deps.py:45 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of fastapi/full-stack-fastapi-template@8063fe54f1 (2026-08-26).
Data as JSON: /api/errors/845f98c21b607d1f.
Report an issue: GitHub.