DEV Community

Discussion on: Using GraphQL schema directives for role based authorization

Collapse
 
mucorolle profile image
Muco Rolle Tresor • Edited

Hello Tushar thank you for your article it's really helpfull I was wondering how can we make a custom directive which can ben add on definifination declaration? like this

type Query @auth  {
    posts: [Post!]!
}

type Mutation @auth {
     createPost(post: CreatePostInput): Post!
}

All fields which are in Query and Mutation can then be protect from users who are not logged in.