@requireAuthentication Directive

This directive takes priority over all other operation authentication configurations.

The @requireAuthentication directive configures an operation to require authentication. Data for the operation will only be returned if the user is authenticated. If the user is not authenticated, the user will receive a 401 Unauthorized error.

An example is shown below.

1
2
3
4
5
6
query ($username: String!) @requireAuthentication {
findUser(username: $username) {
id
email
}
}

Was this article helpful to you?
Provide feedback

Edit this page