Hasura Internship Week 3

3.3-Hasura Auth API and Postman Collection

Anwesh Bohidar
Jul 10, 2017 · 2 min read
I know this isn’t the original logo of hasura ….but just couldn’t resist..;)

In my previous blog, we experimented on hasura instant data APIs using Postman. This time we will be see how to handle users, roles and sessions using Hasura auth APIs. These auth API help in authentication and management of user sessions.

Hasura gives a number of APIs for user session and profile management. Here, I will be showing you some of the basic auth APIs.

1.Signup

Start your hasura console and open Postman. In URL section, type http://auth.<project_name>.hasura.me/signup .In the body section, select raw format and set the content type to application/json. In the body type {"username":"user1","password":"pass"}.Then send. You should get response showing your user id and an authentication token.

Copy this auth token as you will require it now while accessing your profile.

2. Accessing Profile

Make another post request to the url http://auth.<project-name>.hasura.me/user/account/info. Give your bearer authorization in the headers as shown. Send it.

3. Logout

Make post request to the url http://auth.<project-name>.hasura.me/user/account/logout. Again, give your bearer authorization in the headers. Send it.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade