mirror of
https://github.com/lanqian528/chat2api.git
synced 2026-06-16 21:10:55 +08:00
14 lines
349 B
Python
14 lines
349 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 True
|
|
else:
|
|
return False
|