Replies: 1 comment 1 reply
-
Hello @gemone, what I have done on past projects is having a global middleware that store the user on context, then I define a custom GraphQL directive that check for authenticated users (the directive only check if there are a user on the context, nothing fancy, since the JWT middleware already validated the token if present) on the fields that needed to be authenticated to be used. But see that all the authorization is outside Ent, so you can use different methods. You can add directives with entgql Directives annotation and implement it using gqlgen Schema Directives. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
Can fields be authenticated in entgql? And reuse my existing JWT authentication? Just like https://graphql.org/learn/authorization/.
I see that privacy can control database queries. Can user information be passed through context.Context in entgql?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions