Hasura (https://hasura.io) is an open-source tool for building GraphQL APIs. Hasura lets you connect to a new or existing PostgreSQL databases and automatically generate a schema with real-time subscriptions; all with out writing any code!

This allows you to build GraphQL APIs at scale, with zero code, using only a database and Docker image!

This plugin allows you to use your Craft CMS users and groups to generate JWTs to authenticate against your Hasura API, allowing your API content and user authentication to live in two separate services, ensuring your GraphQL API can scale and your Craft CMS site to continue to evolve!

Imagine if you had a user in the CMS who also needed to access the GraphQL API, you would configure the Hasura with roles and permissions based on your user groups you defined within Craft CMS. If that user is not a member of the CMS group that you have defined Hasura to accept, their requests will be rejected.

Here is a sample JWT from a user who is an administrator within Craft CMS and has only a default role (defined in the Hasura plugin settings):

{
  "sub": "04fc4392-02ce-4718-bd93-788c1b5e55f4",
  "admin": true,
  "iat": 1553079269,
  "exp": 1553082869,
  "https://hasura.io/jwt/claims": {
    "x-hasura-allowed-roles": [
      "user",
      "admin"
    ],
    "x-hasura-default-role": "admin",
    "x-hasura-user-id": "04fc4392-02ce-4718-bd93-788c1b5e55f4"
  }
}

Free

Package Name

To install this plugin, search for its package name on the Plugin Store and click “Install”.


Information

Report an issue