Home / Companies / Nhost / Blog / Post Details
Content Deep Dive

How to Add Authentication to Hasura

Blog post from Nhost

Post Details
Company
Date Published
Author
Johan Eliasson
Word Count
867
Language
English
Hacker News Points
-
Summary

Hasura Auth provides a streamlined solution for integrating authentication with Hasura's GraphQL API, addressing the gap left by Hasura's built-in authorization which does not handle user sign-in or token management. Developed as an open-source service tailored specifically for Hasura, it offers multiple sign-in methods including email and password, magic links, SMS, and social providers like Facebook and Google. Users are stored in a Postgres database and accessed via GraphQL, with passwords securely hashed using bcrypt. The service integrates seamlessly with Hasura's permission system, utilizing JWT and refresh tokens for secure authentication processes. For ease of implementation, Nhost offers a managed backend service that automatically provisions the necessary infrastructure, including Postgres, Hasura, and Hasura Auth, allowing developers to focus on application development rather than backend configuration. Alternatively, Hasura Auth can be self-hosted using Docker, with sufficient documentation and examples provided for setting up the environment. The service is written entirely in TypeScript and includes a JavaScript SDK, facilitating easy integration with client applications, including support for React and Apollo GraphQL clients.