> For the complete documentation index, see [llms.txt](https://docs.physiqo.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.physiqo.in/04-product/prd.md).

# Authentication

## Authentication Module

***

## 1. Purpose

This module manages authentication and identity verification for all users of the PhysiQo platform.

The objective is to provide a secure, simple and frictionless login experience while minimizing user effort.

***

## 2. Supported Users

The authentication module currently supports:

* Patient
* Physiotherapist
* Administrator

Future versions may support:

* Corporate HR
* Operations Team
* Customer Support Executives

***

## 3. Authentication Method

Current Version

* Mobile Number
* OTP Verification

Not Supported

* Password Login
* Social Login

Future

* Google Login
* Apple Login

***

## 4. Authentication Goals

The module shall:

* Reduce login friction.
* Eliminate password management.
* Improve account security.
* Enable quick onboarding.
* Support mobile-first experience.

***

## 5. Patient Login Flow

Patient enters mobile number.

↓

System validates mobile number.

↓

OTP generated.

↓

OTP sent through WhatsApp.

↓

Patient enters OTP.

↓

OTP verified.

↓

Patient logged in.

↓

JWT Token generated.

↓

Redirect to Dashboard.

```mermaid
flowchart TD

A[Enter Mobile Number]

A --> B[Validate Mobile]

B --> C[Generate OTP]

C --> D[Send OTP]

D --> E[Enter OTP]

E --> F{OTP Valid?}

F -->|Yes| G[Generate JWT]

G --> H[Dashboard]

F -->|No| I[Retry]
```

***

## 6. Validation Rules

The platform shall validate:

* Mobile Number Format
* OTP Expiry
* OTP Attempt Limit
* Duplicate Requests
* User Status

Invalid requests shall return appropriate error responses.

***

## 7. Error Messages

| Scenario          | Message                                           |
| ----------------- | ------------------------------------------------- |
| Invalid Mobile    | Please enter a valid mobile number.               |
| OTP Expired       | OTP has expired. Please request a new OTP.        |
| Incorrect OTP     | Invalid OTP. Please try again.                    |
| Too Many Attempts | Too many attempts. Please try again later.        |
| Suspended Account | Your account has been suspended. Contact support. |

***

## 8. Security Requirements

* OTP validity: 5 minutes.
* Maximum OTP attempts: 5.
* Maximum OTP resend requests shall be rate limited.
* JWT shall have configurable expiration.
* HTTPS shall be mandatory.
* Authentication events shall be logged.

***

## 9. Future Enhancements

* Google Login
* Apple Login
* Multi-Factor Authentication (MFA)
* Trusted Devices
* Device Management
* Session History

***

## Related Documents

* Business Rules
* User Journey
* Platform Overview
* Decision Log

***

Status

Draft


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.physiqo.in/04-product/prd.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
