# Common 🎨

# Authentication 🎨

📌 POST:/office/login

# Request (Body)

  • mobno : String 10 Digit Mobile Number
  • password : String
  • offid : String with exact 6 digit length. In all caps. Example: 'OFF002'

# Response (Success)

// Response Code : 200
// Headers will contain Set-Cookie directive
// Set-Cookie: jamkuauth=s%3A5ebRRRIXpEK5on46Oqek5K-c6wdsdspP.yLtbm2rTW52PoxfKz7edOs0GLOPZHELfgGXBD6SnCA0;
{
  "success": true,
  "msg": "Login successful",
  "isauthset": true,
  "data": {
    "id": "OFF002",
    "offname": "Demo Office",
    "username": "adi1"
  }
}

Use the cookie jamkuauth to authenticate all the routes. i.e. pass the cookie which you receive to all the api to authenticate the user. The Cookie will expire in some point in future. (Currently set at 8 hours).

If you send expired cookie to any API, it will response with Response code 401. In this case, you will need to call the login api once again to obtain new cookie.

As general best practice, never store the password in database. Use environment variables instead if you are calling the API from your server. Use app storage if you are calling the API from mobile app.

# Response (Error - Data not sent with correct values)

// If you pass `offid` which is not 6 characters
{
  "errors": {
    "offid": [
      "6 Characters"
    ]
  },
  "success": false,
  "msg": "Check Parameters"
}

# Response (Error - Password Incorrect)

// Response Code - 200
{
  "success": false,
  "msg": "Password does not match"
}

# Response (Error - License Expired/OfficeID not found)

// Response Code - 200
{
  "success": false,
  "msg": "Contact Madrecha Solutions"
}
Last Updated: 01 Oct 2019