|
|
|
@ -1,7 +1,4 @@
|
|
|
|
|
from datetime import datetime, timedelta
|
|
|
|
|
from os import environ
|
|
|
|
|
from typing import Optional
|
|
|
|
|
|
|
|
|
|
from fastapi import APIRouter, Depends, HTTPException, status
|
|
|
|
|
from fastapi.security import OAuth2PasswordRequestForm
|
|
|
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
@ -25,9 +22,9 @@ async def login_for_access_token(
|
|
|
|
|
detail="Incorrect email or password",
|
|
|
|
|
headers={"WWW-Authenticate": "Bearer"},
|
|
|
|
|
)
|
|
|
|
|
access_token_expires = timedelta(minutes=settings.access_token_expire_minutes)
|
|
|
|
|
access_token_expiry = timedelta(minutes=settings.access_token_expire_minutes)
|
|
|
|
|
access_token = crud.create_access_token(
|
|
|
|
|
data={"sub": user.username}, expires_delta=access_token_expires
|
|
|
|
|
data={"sub": user.username}, expires_delta=access_token_expiry
|
|
|
|
|
)
|
|
|
|
|
return models.Token(access_token=access_token, token_type="bearer")
|
|
|
|
|
|
|
|
|
|