Adding gqlgen as a remote schema to hasura while having authentication? #3802
-
Hello, my app is written in golang and I am using gqlgen as a remote schema to hasura. I am trying to add authentication to my gqlgen queries where basically I validate a jwt token and extract some user info (e.g. email) from this token. Problem is that when I add this authentication as middleware to my echo server (which runs gqlgen's endpoints) gqlgen disconnects from hasura. AFAIK hasura runs an introspection query to gqlgen and because there is no token it fails. How can I proceed with this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can add directive (example |
Beta Was this translation helpful? Give feedback.
You can add directive (example
@authenticated
) and put it on your queries, mutations and subscriptions, and use your middleware to inject the auth state into the context where your directive can decide how to handle it.