Auth
Log In
You can add users by using the /users/auth/login endpoint. And passing user data as JSON in body.
Request:
 [POST] http://fake-shop-api.ap-south-1.elasticbeanstalk.com/app/v1/users/auth/login
Body:
{
  "email": "test2@example.com",
  "password": "test1234"
}
Response:
{
  "status": "success",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0YzllOTlmZTk5MmI1MDBjOTBkNzQ1ZSIsImlhdCI6MTY5MjExMjk4MSwiZXhwIjoxNjk5ODg4OTgxfQ.WeIvXpwfr0rUbDrW55FJRk81f2C0JcDZJRmGJM3kUQc"
}
Get Profile With Session
You can get the profile the current user with session if in the headers include the Authorization key with the valueBearer {your access token} to/auth/profile
Request:
 [GET] http://fake-shop-api.ap-south-1.elasticbeanstalk.com/app/v1/users/auth/login
Header:
{
  "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0YzllOTlmZTk5MmI1MDBjOTBkNzQ1ZSIsImlhdCI6MTY5MDk2MTAwMSwiZXhwIjoxNjk4NzM3MDAxfQ.ZVUdCYSQKJTWs-55l3hNu9f4jPYcdMIFHgCVBuVPvpg"
}
Response:
{
  "status": "success",
  "data": {
    "address": {
      "street": "456 Elm Street",
      "city": "Othertown",
      "state": "Otherstate",
      "postalCode": "67890",
      "country": "USA"
    },
    "_id": "64c9e99fe992b500c90d745e",
    "name": "Spider Man",
    "email": "test2@example.com",
    "__v": 0,
    "photo": "https://cdn.pixabay.com/photo/2020/03/29/17/23/spiderman-4981530_1280.jpg"
  }
}
Note : Token is valid for 90 days only.