change-password
Method: POST
Path: /auth/change-password
Tags: Users
Summary
Change password
Description
Changes the authenticated user's password. Requires the current password and the new password.
Storefront SDK Usage
SDK Method: sdk.auth.changePassword()
Example:
typescript
// Change user's password
const { data, error } = await sdk.auth.changePassword({
old_password: "currentPassword123",
new_password: "newSecurePassword456",
confirm_password: "newSecurePassword456"
});
if (error) {
console.error("Password change failed:", error.message);
} else {
console.log("Password changed successfully");
console.log("Password changed:", data.message);
}TypeScript Definition
typescript
"change-password": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": {
/** @description The old password associated with the user's account. This parameter is crucial for verifying the user's identity before allowing a password change. */
old_password: string;
/** @description The new password that the user intends to set for their account. This parameter is necessary for updating the password to enhance account security. */
new_password: string;
/** @description A confirmation of the new password. */
confirm_password: string;
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
/** @description A descriptive message confirming the success or failure of the change password operation. */
message: string;
/** @description Indicates whether the request was successful or failure (true for success, false for failure). */
success: boolean;
};
};
};
400: components["responses"]["AuthBadRequest"];
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
/** @description The account does not exist or is inactive. */
404: components["responses"]["NotFound"];
500: components["responses"]["InternalServerError"];
504: components["responses"]["GatewayTimeout"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["responses"]["AuthBadRequest"] | AuthBadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["Forbidden"] | Forbidden |
components["responses"]["NotFound"] | NotFound |
components["responses"]["InternalServerError"] | InternalServerError |
components["responses"]["GatewayTimeout"] | GatewayTimeout |
Request Body
Content Types: application/json
Responses
200
OK
400
Bad request
401
Authentication failed. Codes include token-required, token-expired and token_not_valid for an invalid or expired token.
403
Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.
404
Requested resource not found
500
The request failed because of an unexpected error.
504
The request timed out.
OpenAPI Definition
json
{
"tags": [
"Users"
],
"operationId": "change-password",
"summary": "Change password",
"description": "Changes the authenticated user's password. Requires the current password and the new password.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/change-password",
"description": "API reference for the change-password operation"
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"old_password",
"new_password",
"confirm_password"
],
"properties": {
"old_password": {
"description": "The old password associated with the user's account. This parameter is crucial for verifying the user's identity before allowing a password change.",
"type": "string",
"minLength": 1,
"pattern": "\\S"
},
"new_password": {
"description": "The new password that the user intends to set for their account. This parameter is necessary for updating the password to enhance account security.",
"type": "string",
"minLength": 1,
"pattern": "\\S"
},
"confirm_password": {
"description": "A confirmation of the new password.",
"type": "string",
"minLength": 1,
"pattern": "\\S"
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success"
],
"properties": {
"message": {
"description": "A descriptive message confirming the success or failure of the change password operation.",
"type": "string"
},
"success": {
"description": "Indicates whether the request was successful or failure (true for success, false for failure).",
"type": "boolean"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/AuthBadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"description": "The account does not exist or is inactive.",
"$ref": "#/components/responses/NotFound"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
},
"504": {
"$ref": "#/components/responses/GatewayTimeout"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "auth",
"x-speakeasy-ignore": true,
"x-speakeasy-name-override": "changePassword"
}Auto-generated from OpenAPI spec and TypeScript definitions