Test out permissions

Let's go ahead and start testing the permissions through the GraphQL API for todos table.


Now let's go ahead and query the data by adding two request headers:

  • x-hasura-role: user
  • x-hasura-user-id: 1
query {
todos {

You should get a response looking something like this:

Todo Query

Note that the response received is filtered for the user id 1. If you change the value for x-hasura-user-id to 2, the data would be returned only for the user id 2. This confirms the permissions that we configured in the previous steps.

You can test the permission configuration similarly for the users table as well.


Get Started with GraphQL Now

Hasura Cloud gives you a fully managed, production ready GraphQL API as a service to help you build modern apps faster.
Ready to get started?
Start for free on Hasura Cloud or you could contact our sales team for a detailed walk-through on how Hasura may benefit your business.
Stay in the know
Sign up for full access to our community highlights, new features, and occasional baby animal gifs! Oh, and we have a strict no-spam rule. ✌️