Spaces:
Sleeping
Sleeping
File size: 648 Bytes
950b31b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | from fastapi import FastAPI,Request,HTTPException,Response
from pydantic import BaseModel
from fastapi.responses import JSONResponse
import uuid
from fastapi.middleware.cors import CORSMiddleware
import json
import base64
from components.middleware import x401Kit
app=FastAPI()
origins=["*"]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.add_middleware(
x401Kit,
protected_paths=[
"/x401_auth_agent"
]
)
@app.get("/x401_auth_agent")
def Auth401(request:Request):
return {"token":""} |