-
I am trying to implement custom directive as in this example: https://www.graphql-tools.com/docs/schema-directives#enforcing-access-permissions In example the function getUser used to retrieve user details (roles) based on token sent in auth header. const server = new ApolloServer({ It is available in Query/Mutation resolvers on context object. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I found answer myself. When I console.log'ed the "context" object my custom authUser object was not printed, so I assumed it is not there. But when I analyzed context object via debugger, it was actually present there. So this is already working as I expected and I can access it via "context.authUser" inside custom field resolver function. |
Beta Was this translation helpful? Give feedback.
I found answer myself. When I console.log'ed the "context" object my custom authUser object was not printed, so I assumed it is not there. But when I analyzed context object via debugger, it was actually present there. So this is already working as I expected and I can access it via "context.authUser" inside custom field resolver function.