Hasura Internship: Task 3.3

Abhishek Kumar Roy
Jul 23, 2017 · 3 min read

Hello all, this is the eighth blog in Hasura internship’s blogs series. This blog is for Task 3.1. After discussing about data api queries it’s time for some auth api queries. Auth api queries means query to authenticate a user of the app via signup or login. Refer to this blog to know about the data models for my app:

To get some context about what is api how to do data api queries and what tool we are using to do so refer to my previous blog:

You can get details about different auth api provided by hasura here:

There are different api endpoints, header and body type setting for each auth requests, so let’s talk about all of it one by one.

Signup:

  • Header: Only “Content-Type” header set to “application/json”
  • Request: Body type is set to “raw” and “JSON(application/json)”, method is POST with the signup endpoint.
  • Response:

Login:

  • Header: Only “Content-Type” header set to “application/json”
  • Request: Body type is set to “raw” and “JSON(application/json)”, method is POST with the login endpoint.
  • Response:

Logout:

  • Header: “Authorization” is set to “Bearer <authorization_token>” which you get in response after signup or login
  • Requests: No body is required for logout just send the POST request to the logout api endpoint which you can see in the header image
  • Response:

To see all the data api queries that I made you can look at this postman collection:

So that’s all for now, I will be updating the blog for any changes made during the course of implementing the app. Thanks :)

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