What is authentication in Injee?

Injee is an automated backend not meant for serious projects, it was created due to frustration of a backend developer who was forced to learn ReactJS. To learn it, he had to concentrate on ReactJS hard, for that the developer should not think about the backend, it’s for that Injee was created.

Injee is great for learners, and it’s great for POC. Maybe it will get better, maybe not. So authentication in Injee might not be super professional. This document will describe how.

How it will work

So you are a designer / front end dev, you have designed a page like this.

Once the user clicks login, ask for username, and password; or email, and password. Say the user credentials are stored in table users, give a POST hit as shown:

POST /auth/:table/login

You can pass the these parameters in the hit:

{
  "username": "......",
  "password": "......"
}

It could also be email and password as shown. Pass them as body params.

{
  "email": "......",
  "password": "......"
}

Once successful login, the response will be as shown:

{
  "token": "slkdgslkjg3284923rsdfjsdfj"
}

This token will be accoumpanied by HTTP status 200. Else with status 401 unauthorized, you will get a message as shown:

{
  "message": "Invalid username or password"
}

To get user details, one needs to hit a URL like this:

GET /auth/:table/current

Along with the auth token which was returned on successful login. You might get the user details as shown:

{
  "username": "......",
  "first_name": "......",
  "last_name": "......",
  "email": "......",
  ....
}

Once logged in you might change the UI top reflect a user icon.

When clicked it might goto users page, which displays user details.