MCPcopy Create free account
hub / github.com/ScrapeGraphAI/scrapecraft / login

Function login

backend/app/api/auth.py:139–153  ·  view source on GitHub ↗

Login and get access token.

(form_data: OAuth2PasswordRequestForm = Depends())

Source from the content-addressed store, hash-verified

137
138@router.post("/token", response_model=Token)
139async def login(form_data: OAuth2PasswordRequestForm = Depends()):
140 """Login and get access token."""
141 user = authenticate_user(form_data.username, form_data.password)
142 if not user:
143 raise HTTPException(
144 status_code=status.HTTP_401_UNAUTHORIZED,
145 detail="Incorrect username or password",
146 headers={"WWW-Authenticate": "Bearer"},
147 )
148 access_token_expires = timedelta(hours=settings.JWT_EXPIRATION_HOURS)
149 access_token = create_access_token(
150 data={"sub": user.username},
151 expires_delta=access_token_expires
152 )
153 return {"access_token": access_token, "token_type": "bearer"}
154
155@router.get("/me", response_model=User)
156async def read_users_me(current_user: User = Depends(get_current_active_user)):

Callers

nothing calls this directly

Calls 2

authenticate_userFunction · 0.85
create_access_tokenFunction · 0.85

Tested by

no test coverage detected