MCPcopy
hub / github.com/learnhouse/learnhouse / _require_api_token

Function _require_api_token

apps/api/src/services/admin/admin.py:58–65  ·  view source on GitHub ↗

Ensure the current user is an API token.

(current_user)

Source from the content-addressed store, hash-verified

56
57
58def _require_api_token(current_user) -> APITokenUser:
59 """Ensure the current user is an API token."""
60 if not isinstance(current_user, APITokenUser):
61 raise HTTPException(
62 status_code=status.HTTP_403_FORBIDDEN,
63 detail="This endpoint requires API token authentication",
64 )
65 return current_user
66
67
68async def _resolve_org_slug(org_slug: str, token_user: APITokenUser, db_session: AsyncSession) -> Organization:

Calls

no outgoing calls

Tested by 3