You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Had to shift the frontegg.init_app inside lifespan function for FastAPI #122
After an upgrade to Frontegg version 3.0.0 my authentication calls started failing.
So I came to this repo and changed my fastapi app startup using a startup_event function. But that didn't work either.
FastAPI version 0.92.0
I had to instead add it to a lifespan function as follows:
@asynccontextmanagerasyncdeflifespan(app: FastAPI):
""" This function is used to run a task in the background for the entire lifespan of the application. Args: app (FastAPI): FastAPI application instance frontend.init_app() is used to initialize the Frontegg SDK. """print("Starting lifespan...")
awaitfrontegg.init_app(client_id=FRONTEGG_CLIENT_ID, api_key=FRONTEGG_API_KEY)
try:
yieldfinally:
print("Stopping lifespan...")
app=FastAPI(debug=True, lifespan=lifespan)
Activity
chirag-mehta commentedon Jan 28, 2024
Also, if it makes sense consider adding "frontegg 3.0.0 requires changing the frontegg app startup" to breaking changes.