mirror of
https://github.com/lanqian528/chat2api.git
synced 2026-06-13 21:02:46 +08:00
16 lines
412 B
Python
16 lines
412 B
Python
from fastapi import Depends
|
|
from fastapi.security import OAuth2PasswordBearer
|
|
|
|
from utils.config import authorization_list
|
|
|
|
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
|
|
|
|
|
|
def verify_token(token: str = Depends(oauth2_scheme)):
|
|
if not authorization_list or token in authorization_list:
|
|
return token
|
|
elif token.startswith("eyJhbGciOi"):
|
|
return token
|
|
else:
|
|
return False
|