Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middleware #59

Open
simplenotezy opened this issue Jun 27, 2024 · 0 comments
Open

Middleware #59

simplenotezy opened this issue Jun 27, 2024 · 0 comments

Comments

@simplenotezy
Copy link

How could we go about integrating middleware? I have a lot of endpoints, and most of them are protected by requiring a Bearer (which is added to the Context).

I am looking for a way to check if this bearer is present, and if not, throw some GraphQL error. But I'd prefer not to repeat this logic across all queries/mutations.

Instead it would be preferable to do some check once, e.g.

if(query.mutation.name !== 'authenticate') {
// ensure bearer is present, or throw unauthorized error
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant