Skip to content

Commit 587906a

Browse files
committed
Add clarification about auth directive usage.
1 parent fc47a37 commit 587906a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pages/learn/authorization.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ In the example above, we see that the business logic layer requires the caller t
6464
6565
## Using type system directives
6666
67-
In the example above, we saw how authorization logic can be delegated to the business logic layer through a function that is called in a field resolver.
67+
In the example above, we saw how authorization logic can be delegated to the business logic layer through a function that is called in a field resolver. In general, it is recommended to perform all authorization logic in that layer, but if you decide to implement authorization in the GraphQL layer instead then this may be accommplished using [type system directives](/learn/schema/#directives).
6868
69-
Another approach when implementing authorization checks for a GraphQL API is to use [type system directives](/learn/schema/#directives), where a directive such as `@auth` is defined in the schema with arguments that can indicate what roles or permissions a user must have to access the data provided by the and fields where the directive is applied. For example:
69+
For example, a directive such as `@auth` could be defined in the schema with arguments that indicate what roles or permissions a user must have to access the data provided by the types and fields where the directive is applied:
7070
7171
```graphql
7272
directive @auth(rule: Rule) on FIELD_DEFINITION

0 commit comments

Comments
 (0)