MCPcopy
hub / github.com/AgentOps-AI/agentops / auth_login

Function auth_login

app/api/agentops/auth/views.py:406–428  ·  view source on GitHub ↗

Handle username/password logins.

(request: Request, body: LoginSchema)

Source from the content-addressed store, hash-verified

404# TODO annotate response type
405@public_route
406async def auth_login(request: Request, body: LoginSchema) -> JSONResponse:
407 """
408 Handle username/password logins.
409 """
410 supabase = get_supabase()
411 # returns `AuthResponse` (.venv/lib/python3.12/site-packages/gotrue/types.py:95)
412 try:
413 auth_response = supabase.auth.sign_in_with_password(
414 {
415 'email': body.email,
416 'password': body.password,
417 }
418 )
419 except gotrue.errors.AuthApiError as e:
420 raise AuthException.from_gotrue_autherror(e)
421
422 if hasattr(auth_response, 'error'):
423 raise AuthException()
424
425 access_token = auth_response.session.access_token
426 content = StatusResponse(message="User authenticated successfully.")
427 response = JSONResponse(content=content.model_dump())
428 return _create_session_for_response(response, access_token)
429
430
431@public_route

Callers

nothing calls this directly

Calls 6

get_supabaseFunction · 0.90
AuthExceptionClass · 0.85
from_gotrue_autherrorMethod · 0.80
StatusResponseClass · 0.70
model_dumpMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…