Skip to Content
HomeLink Hub
Authentication

Set a new password with a reset token or code

POST
/api/v1/auth/reset-password

Access: Public, no token needed.

Completes a password reset. If token is exactly 4 characters long it is treated as the mobile code and email is required; otherwise it is treated as the JWT from the reset link and email is ignored. The token or code must be the most recently issued one for the account.

On success the password is replaced, the reset token is cleared and the stored refresh token is removed, so POST /auth/refresh-token fails until the user signs in again. Access tokens that were already issued stay valid until they expire, and the session list is not cleared. A password_changed notification ("Password Changed") is created, delivered in-app, by push and by email according to the user's systemUpdates preferences. No tokens are returned.

Error statuses for a bad link token are inconsistent: a malformed token gives 400, an expired one gives 500.

Request Body

application/json
  1. body
token*string

Either the JWT from the reset link, or the 4-digit code from the mobile reset email.

password*string

The new password, 8-128 characters.

Length8 <= length <= 128
email?string

Account email. Required when token is a 4-digit code; ignored for link tokens.

Formatemail

Response Body

Password changed

application/json
  1. response
status*integer
success*boolean
message*string
data*unknown
Example Request
curl -X POST 'http://localhost:4000/api/v1/auth/reset-password' \  -H 'Content-Type: application/json' \  -d '{  "token": "4821",  "password": "N3w-S3cure-Passw0rd",  "email": "adaeze.okonkwo@example.com"}'
Example Response
{  "status": 200,  "success": true,  "message": "Password reset successfully. Please sign in with your new password.",  "data": null}