MCPcopy Create free account
hub / github.com/clockworknowledge/menome_processor / login_for_access_token

Function login_for_access_token

app/routers/processing.py:160–172  ·  view source on GitHub ↗
(form_data: OAuth2PasswordRequestForm = Depends())

Source from the content-addressed store, hash-verified

158## Returns an access token based on username and password
159@router.post("/token", response_model=Token, description="Returns an access token", summary="Returns an access token", tags=["Users"])
160async def login_for_access_token(form_data: OAuth2PasswordRequestForm = Depends()):
161 user = authenticate_user(form_data.username, form_data.password)
162 if user is None:
163 raise HTTPException(
164 status_code=status.HTTP_401_UNAUTHORIZED,
165 detail="Incorrect username or password",
166 headers={"WWW-Authenticate": "Bearer"},
167 )
168 access_token_expires = timedelta(minutes=AppConfig.ACCESS_TOKEN_EXPIRE_MINUTES)
169 access_token = create_access_token(
170 data={"sub": user.username}, expires_delta=access_token_expires
171 )
172 return {"access_token": access_token, "token_type": "bearer"}
173
174## Basic health check
175@router.post("/divide")

Callers

nothing calls this directly

Calls 2

authenticate_userFunction · 0.85
create_access_tokenFunction · 0.85

Tested by

no test coverage detected