Password Management Guide
This guide outlines the implementation details for handling password expiry and the "Forgot Password" workflow for client applications integrating with the V3NITY PaaS API.
1. Password Expiry Process
The system enforces password rotation policies. When a user's password expires, the login process will signal the client to perform a mandatory password update.
Detection
When calling the /login endpoint, the JSON response includes a password_expired boolean flag.
{
"access_token": "...",
"password_expired": true,
"first_time_login": false,
...
}
Restricted Token
If password_expired is true, the issued access_token has a limited lifespan (typically 10 minutes) and is restricted to password change operations only.
Implementation
The client application should immediately redirect the user to a "Change Password" screen and call the following endpoint:
Request Headers
Authorization: Bearer {access_token}Content-Type: application/json
Request Body
{
"old_password": "current_expired_password",
"new_password": "new_secure_password"
}
Response Codes
| Status | Description |
|---|---|
200 OK |
Password updated successfully. The user should be prompted to log in again. |
400 Bad Request |
Validation failed (e.g., password too weak, matches history, or matches username). |
2. Forgot Password Process
The "Forgot Password" workflow is a two-step process involving identity verification via a One-Time Password (OTP) sent to the user's registered email or phone.
Step 1: Request Password Reset
Initiate the reset process by providing the username and a verification channel.
Request Body
{
"username": "john_doe",
"email": "john@example.com",
"phone": "+6512345678"
}
Provide either email or phone. The system will verify if the provided contact matches the records for that username.
Response
{
"reset_token": "a1b2c3d4..."
}
The user will receive an OTP via the chosen channel. The reset_token returned in the response must be persisted by the client for the next step.
Step 2: Verify OTP and Update Password
Complete the reset by submitting the OTP, the token from Step 1, and the new password. You will need a UI screen for this.
Request Body
{
"reset_token": "a1b2c3d4...",
"otp": "123456",
"new_password": "new_secure_password",
"reset_totp": false
}
Parameters
| Field | Type | Description |
|---|---|---|
reset_token |
String | The token received from the POST request in Step 1. |
otp |
String | The 6-digit code sent to the user. |
new_password |
String | The new password to be set. |
reset_totp |
Boolean | Optional If true, resets the Multi-Factor Authentication (TOTP) secret. |
Token Expiry
Reset tokens typically expire after 30 minutes. If the token expires, the user must restart from Step 1.