> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/health/v2.1/deploy/configuration/hcm-ui-configuration/login.md).

# Login

### 📘 Overview

The **Login** screen enables users to access the DIGIT HCM app by entering their User ID and password. It also provides a **Forgot Password** option that informs users to contact their administrator since the app doesn’t handle password resets directly.

***

### 🔁 Workflow Details

#### Entry Point

* Users are redirected to the login screen immediately after selecting their preferred language.

<div align="left"><figure><img src="https://content.gitbook.com/content/I0KFbSBTySIQ7TCOKnJF/blobs/C6lveUqIjipudWyDTC8e/image.png" alt="" width="207"><figcaption></figcaption></figure></div>

#### User Actions

* **Input Credentials**: User enters **User ID** and **Password**.
* **Login**: Clicks **"Log In"** to authenticate with the backend.
* **Forgot Password**: Clicks the **"Forgot Password"** button (no password reset performed within the app; displays informational dialogue).

***

### ⚙️ Technical Implementation

#### UI Components

* **Login Screen**: Defined in\
  `health_campaign_field_worker_app/lib/pages/login.dart`  \
  Login Page Location: [login.dart](https://github.com/egovernments/health-campaign-field-worker-app/blob/master/apps/health_campaign_field_worker_app/lib/pages/login.dart)
* **Widgets Used**:
  * **DigitTextFormField**: Input fields for user ID and password:  [digit\_text\_form\_input.dar](https://github.com/egovernments/DIGIT-UI-LIBRARIES/blob/master/flutter/digit-ui-components/digit_components/lib/widgets/atoms/digit_text_form_input.dart)
  * **DigitElevatedButton**: Login button component: [digit\_button.dart](https://github.com/egovernments/DIGIT-UI-LIBRARIES/blob/master/flutter/digit-ui-components/digit_components/lib/widgets/atoms/digit_button.dart)
  * **DigitToaster (SnackBar)**: Notification for login success, failure, or errors: [digit\_toast.dart](https://github.com/egovernments/DIGIT-UI-LIBRARIES/blob/master/flutter/digit-ui-components/digit_components/lib/widgets/atoms/digit_toast.dart)

#### Dialogue Integration

* The “Forgot Password” button triggers a **DigitDialog**, displaying a message prompting users to contact their administrator.

***

### 🔐 API Role–Action Mapping

| Action               | API Endpoint                       | Description                                                                               |
| -------------------- | ---------------------------------- | ----------------------------------------------------------------------------------------- |
| Login Authentication | `POST /auth/login` (or equivalent) | Sends credentials (`userID`, `password`) to authenticate user and return a session token. |
| Forgot Password      | –                                  | No backend call; purely client‑side informational dialog                                  |

* **Login Payload Example**:

  ```json
  {
    "RequestInfo": { "authToken": "" },
    "User": {
      "userId": "string",
      "password": "string"
    }
  }
  ```
* **Login Response**: Returns a user token and possibly user role/context data to establish a session and navigation flow.
* **Access Management**: The returned authentication token governs user access across the application.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.digit.org/health/v2.1/deploy/configuration/hcm-ui-configuration/login.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
