Clerk + Hasura
Authenticate your Hasura GraphQL service requests using Clerk as an authentication provider.
Hasura does not handle authentication itself, but delegates the responsibility to authentication providers like Clerk. It requires user role information to be passed in requests. One of the main authentication mechanisms supported by Hasura is through the use of JSON Web Tokens (JWTs) .
Clerk offers the ability to generate JWTs representing users that are signed in to your application.
Clerk's JWT Templates allow you to customize the contents of JWTs.
Our template is pre-populated with the default claims required by Hasura, but we make it easy to include additional claims or modify them as necessary.
Shortcodes are special strings that are substituted for their corresponding values during token generation. Shortcodes are typically used to refer to data that depend on the currently authenticated user.
At Clerk, we love GraphQL. Hasura allows you to connect to a new or existing database to instantly get a production grade GraphQL API.
GraphQL allows for multiple resource requests in a single query call. This saves time and bandwidth by decreasing the amount of necessary network calls.
GraphQL tooling allows you to debug and try queries on a GraphQL server without having to write queries over and over again. Hasura provides a GraphiQL integrated development environment (IDE) console to explore the API.
Hasura and Clerk are part of the modern Frontend Stack.
SaaS is moving to the frontend, enabled by easy-to-use frameworks such as Next.js. Modern web services like Clerk and Hasura, work intuitively together and don't require backend setup, allowing you to quickly develop high-quality applications.
The Frontend Stack saves time and resources, allowing you to focus on what makes your application unique.