Authentication
Change Password
Change user password
POST
Change Password
Endpoint
Overview
Changes the authenticated user’s password. Requires the current password for verification. Password is hashed with bcrypt before storage.Request
string
required
Current password for verification
string
required
New password. Minimum 8 characters.
Response
boolean
Always
true on successstring
“Password changed successfully”
Implementation Details
Process Flow
- Authentication: Verifies user is authenticated
- Current Password Check: Compares provided password with stored hash
- Password Hashing: Hashes new password with bcrypt (10 rounds)
- Update: Updates password hash in database
- Audit Logging: Logs
PASSWORD_CHANGEevent
Code Reference
Status Codes
OK
Password changed successfully
Bad Request
Validation error (new password too short, etc.)
Unauthorized
Invalid current password or missing authentication
Not Found
User not found
Forbidden
Blocked by Arcjet
Example Request
Example Response
Security Considerations
- Current password must be verified before change
- New password is hashed with bcrypt (10 rounds)
- Rate limiting applied (2 requests per bucket)
- All password changes are logged in audit trail
- Old password hash is completely replaced (no history kept)
Audit Events
- PASSWORD_CHANGE: Password successfully changed
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
200
Password changed successfully
Change Password