I'm using FastAPI and now want to add GraphQL using graphene
.
I'm using:
fastapi-user
starlette.graphql.GraphQLApp
Here's the routing for GraphQL and how I used fastapi-user package.
import fastapi_users
from starlette.graphql import GraphQLApp
from mypackage.schema import my_schema
...
app.include_router(fastapi_users.router, prefix="/users", tags=["users"])
app.include_router(google_oauth_router, prefix="/google-oauth", tags=["users"])
app.add_route("/", GraphQLApp(schema=my_schema))
...
In the schema
, I need to get user information and control the role based auth.
How to, or how can I use get_current_active_user()
method with GraphQL schema?