Update server.py

pull/255/head
Keyvan Hardani 9 months ago committed by GitHub
parent c059cf1f94
commit 4d66490f02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -147,15 +147,8 @@ async def authenticate(websocket: WebSocket):
# Verify the provided token
token = auth_response.get("token")
if not token:
await websocket.send_json({"type": "auth_failure"})
await websocket.close()
return False
try:
# Use the OAuth2PasswordBearer scheme to validate the token
token = await oauth2_scheme(token)
except Exception:
expected_token = os.getenv("WS_TOKEN")
if token != expected_token:
await websocket.send_json({"type": "auth_failure"})
await websocket.close()
return False

Loading…
Cancel
Save