# Mobile - Login

| **API URL**     | {{url}}/auth-service/session |
| --------------- | ---------------------------- |
| **Method**      | POST                         |
| **Description** | Login and get Access Token   |

#### **Input** <a href="#mobile-login-input" id="mobile-login-input"></a>

| **Field Name** | **Type** | **Mandatory** | **Example**         |
| -------------- | -------- | ------------- | ------------------- |
| username       | String   | Yes           | <superXXXn@XXX.mdt> |
| password       | String   | Yes           | Hashed Password     |
| client(Header) | String   |               | spice mobile        |

#### **Sample Input:** <a href="#mobile-login-sampleinput" id="mobile-login-sampleinput"></a>

#### No request - Will be handled based on App version from Headers and form value of user name and password. <a href="#mobile-login-norequest-willbehandledbasedonappversionfromheadersandformvalueofusernameandpassword" id="mobile-login-norequest-willbehandledbasedonappversionfromheadersandformvalueofusernameandpassword"></a>

#### **Output** <a href="#mobile-login-output" id="mobile-login-output"></a>

| **Field Name**       | **Type**                   | **Comments**                 |
| -------------------- | -------------------------- | ---------------------------- |
| `id`                 | Integer                    | User ID                      |
| `username`           | String                     | Login email ID               |
| `gender`             | String                     | User’s gender                |
| `roles`              | String                     | User role                    |
| `active`             | Boolean                    | Is active                    |
| `accountExpired`     | Boolean                    | Is account expired           |
| `accountLocked`      | Boolean                    | Is account locked            |
| `credentialsExpired` | Boolean                    | Is credentials expired       |
| `authorization`      | Boolean                    |                              |
| `currentDate`        | Timestamp without timezone | Date                         |
| `firstName`          | String                     | User first name              |
| `lastName`           | String                     | User last name               |
| `middleName`         | String                     | User middle name             |
| `phoneNumber`        | String                     | User Phone number            |
| `timezone`           | Timestamp                  | Time zone of user            |
| `organizations`      | Bigint                     | User’s organization          |
| `tenantId`           | Bigint                     |                              |
| `countryCode`        | String                     | User’s country code          |
| `isBlocked`          | Boolean                    |                              |
| `country`            | String                     | User’s country               |
| `deviceInfoId`       | Bigint                     | User’s device information ID |
| `isSuperUser`        | Boolean                    | Is super user                |
| `cultureId`          | Bigint                     | Culture ID of user           |

#### **Sample Output:** <a href="#mobile-login-sampleoutput" id="mobile-login-sampleoutput"></a>

```
{
  "id": 5,
  "username": "kavya_pro@spice.mdt",
  "gender": "Female",
  "roles": [
    {
      "id": 17,
      "name": "PROVIDER",
      "level": null,
      "authority": "PROVIDER",
      "createdBy": 0,
      "updatedBy": 0,
      "createdAt": null,
      "updatedAt": null,
      "active": true,
      "deleted": false
    }
  ],
  "active": true,
  "accountExpired": false,
  "accountLocked": false,
  "credentialsExpired": false,
  "authorization": null,
  "currentDate": 1685527129699,
  "firstName": "Kavya",
  "lastName": "Provider",
  "middleName": null,
  "subject": null,
  "phoneNumber": "887XXX7565",
  "timezone": {
    "id": 1,
    "offset": "+05:30",
    "description": "(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi"
  },
  "organizations": [
    {
      "id": 4,
      "name": "Medical Care"
    }
  ],
  "tenantId": 4,
  "countryCode": "254",
  "isBlocked": false,
  "country": {
    "id": 1,
    "name": "Kenya",
    "countryCode": "254",
    "unitMeasurement": "metric",
    "tenantId": 1
  },
  "deviceInfoId": null,
  "isSuperUser": false,
  "cultureId": 1
}
```
