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
I'm looking for a way to implement an authorize field directive.
"""Signifies that a field requires authorization for a result to be returned"""directive@authorizeonFIELD_DEFINITION
The idea is that any field with this directive would require the appropriate authorization to be able to access, whether it be in a Query/Mutation/Subscription or another custom type in the schema. The server, using Graphql Yoga, would make sure the client had the authorization needed to access the fields requested.
However, the documentation is not clear on how I could achieve this. The Graphql Codegen docs use a plugin, but the Graphql Tools docs say to write it in javascript. The confusing part is that Graphql Codegen generates some resolver types for the directive, as shown below.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm looking for a way to implement an
authorizefield directive.The idea is that any field with this directive would require the appropriate authorization to be able to access, whether it be in a
Query/Mutation/Subscriptionor another custom type in the schema. The server, using Graphql Yoga, would make sure the client had the authorization needed to access the fields requested.However, the documentation is not clear on how I could achieve this. The Graphql Codegen docs use a plugin, but the Graphql Tools docs say to write it in javascript. The confusing part is that Graphql Codegen generates some resolver types for the directive, as shown below.
How would I go about using these types? If they're unusable, how can I integrate either the Graphql Tools or the plugin approach with Graphql Codegen?
Beta Was this translation helpful? Give feedback.
All reactions