OAuth token request fails when used inside FastAPI dependency with request timeout
Description
When using the SDK inside a FastAPI dependency, token creation fails if the request context times out.
Code snippet
from fastapi import Depends, FastAPI
from openapi_sdk import OauthClient
app = FastAPI()
def get_token():
client = OauthClient("user", "apikey", test=True)
return client.create_token(["scope"], 3600)
@app.get("/")
def read_root(token=Depends(get_token)):
return {"token": token}
Observed behavior
Occasional timeout errors or incomplete responses.
Expected behavior
Token generation should be resilient to request lifecycle timing.
OAuth token request fails when used inside FastAPI dependency with request timeout
Description
When using the SDK inside a FastAPI dependency, token creation fails if the request context times out.
Code snippet
Observed behavior
Occasional timeout errors or incomplete responses.
Expected behavior
Token generation should be resilient to request lifecycle timing.