Reputation: 724
First of all the project is amazing, I had GraphQL working with MongoDB very quickly. Even GraphiQL with the ModHeader extension. However, I am trying to add policies to the graphQL endpoints and I am finding that ctx.session
is always empty, even tho I am making authorized requests (via the Bearer token)
How does session work in this example? Do I need to query for the user every single time I create a request?
Upvotes: 2
Views: 1124
Reputation: 266
The user info is available through the ctx.state.user
object and not the ctx.session
. Also, feel free to take a look at the GraphQL example https://github.com/strapi/strapi-examples/tree/master/react-apollo
Upvotes: 3