Hello folks, I am making a GPT, but I get this error:
‘Access to script at ‘https://cdn.oaistatic.com/_next/static/chunks/sso.2ae157e264cf021c.js?dpl=d36200b0c04e43a1eea4f89b7758cff9abb7389f’ from origin ‘https://chat.openai.com’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.’
This is my code with CORS:
app = FastAPI(
title="Base de datos de empresa",
description="API para recuperar informacion de base de datos con documentos de una empresa",
version="0.1",
lifespan=lifespan
)
app.add_middleware(
CORSMiddleware,
allow_origins=['*'],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@router.get("/oauth/authorize")
async def authorize(request: Request):
# Añadir parámetros adicionales
auth0_authorize_url = f"https://chat.openai.com/aip/g-someid/oauth/callback?{urlencode(request.query_params)}"
print(f'---- {auth0_authorize_url}')
return RedirectResponse(url=auth0_authorize_url)
@router.post("/oauth/token")
async def access_token(request:Request):
print(request.query_params)
return JSONResponse(content={ "access_token": "example_token", "token_type": "bearer", "refresh_token": "example_token", "expires_in": 1600, "nombre de usuario":"Riby" }, status_code=200)