from fastapi import Depends,HTTPException,status from server.service.jwttoken import verify_shop_token, verify_token from fastapi.security import OAuth2PasswordBearer oauth2_scheme = OAuth2PasswordBearer(tokenUrl="login") oauth2_shop_scheme = OAuth2PasswordBearer(tokenUrl="shop_login") def get_current_user(token: str = Depends(oauth2_scheme)): credentials_exception = HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, detail="Could not validate credentials", headers={"WWW-Authenticate": "Bearer"}, ) return verify_token(token,credentials_exception) def get_current_shop(token: str = Depends(oauth2_shop_scheme)): credentials_exception = HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, detail="Could not validate credentials", headers={"WWW-Authenticate": "Bearer"}, ) return verify_shop_token(token,credentials_exception)