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
In addition too #1579 and this solution for Apollo Server; maybe it would be a handy feature too incorporate a 401 status error when writing auth middleware?
Upvote & Fund
We're using Polar.sh so you can upvote and help fund this issue.
We receive the funding once the issue is completed & confirmed by you.
Thank you in advance for helping prioritize & fund our backlog.
The text was updated successfully, but these errors were encountered:
I have been looking at converting some existing code from starlette/graphene/fastapi to strawberry/fastapi.
I made great progress quickly and liked what I found. However I now hit this issue where the apps expect to get a 401 Unauthorized HTTP response, if the correct authorization header is missing. Here is our existing code which works like this (slightly shortened):
fromfastapiimportAPIRouter, FastAPI, Requestfromstarlette.graphqlimportGraphQLAppapp=FastAPI()
router=APIRouter()
@router.api_route("/graphql", methods=["GET", "POST"])asyncdef_route_with_auth(request: Request):
authenticate(request)
# ... authenticate() raises a HttpException(status_code=401) if the authorization header is not correct returnawaitGraphQLApp(schema=get_schema()).handle_graphql(
request=request)
app.include_router(router, dependencies=[])
With strawberry I struggled for some time now and did not manage to get this working.
It would be very welcome if this could be supported!
Perhaps there is a workaround which I missed?
In addition too #1579 and this solution for Apollo Server; maybe it would be a handy feature too incorporate a 401 status error when writing auth middleware?
Upvote & Fund
The text was updated successfully, but these errors were encountered: