GraphQL Authentication Directives

JSON →
library 0.3.2 ·javascript
verified May 27, 2026

graphql-directive-auth is a utility library designed to simplify common authentication and authorization tasks in GraphQL APIs by providing schema directives. It offers `@isAuthenticated` and `@hasRole` directives, which can be used to protect fields and types based on JWT tokens and user roles. The current stable version is 0.3.2, indicating it's still in a pre-1.0 development phase, which typically implies an irregular release cadence and potential for API changes. Its key differentiators include a straightforward setup with environment variables for default behavior and highly customizable authentication and role-checking functions for more complex scenarios. It ships with TypeScript types, enhancing developer experience in TypeScript projects. It integrates with `graphql-tools` and expects a `graphql` peer dependency, providing a declarative approach to security within the GraphQL schema itself.

total hits 16
actors 7 distinct systems
last hit 1d ago human
MetaBot
4
GPTBot
2
Script
1
Search engines
3
Humans
1

top countries 🇺🇸 United States · 🇳🇴 Norway · 🇨🇦 Canada · 🇫🇷 France · 🇩🇪 Germany