change-password
Method: POST
Path: /auth/change-password
Tags: Auth
Summary
Change password
Description
The Change Password API is a key feature designed to provide a secure and standardized method for users to update their passwords.
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("New access token:", data.access_token);
}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;
/** @description An object containing the response content. */
content: {
/** @description It is a string-based token utilized for authentication and authorization. */
access_token: string;
/** @description It is a string-based token designed for refreshing the user's access token. */
refresh_token: string;
};
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
Request Body
Content Types: application/json
Responses
200
OK
400
Bad request
401
Not authorized for given operation on the Resource
OpenAPI Definition
json
{
"tags": [
"Auth"
],
"operationId": "change-password",
"summary": "Change password",
"description": "The Change Password API is a key feature designed to provide a secure and standardized method for users to update their passwords.",
"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"
},
"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"
},
"confirm_password": {
"description": "A confirmation of the new password.",
"type": "string"
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success",
"content"
],
"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"
},
"content": {
"description": "An object containing the response content.",
"properties": {
"access_token": {
"description": "It is a string-based token utilized for authentication and authorization.",
"type": "string"
},
"refresh_token": {
"description": "It is a string-based token designed for refreshing the user's access token.",
"type": "string"
}
},
"required": [
"access_token",
"refresh_token"
],
"type": "object"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "auth",
"x-speakeasy-ignore": true,
"x-speakeasy-name-override": "changePassword"
}Auto-generated from OpenAPI spec and TypeScript definitions