login-with-password
Method: POST
Path: /auth/login/password
Tags: Auth
Summary
Login with password
Description
This API endpoint allows users to Login using their password. It requires the following parameters: email/phone and password. Also allows users to securely Login and obtain access and refresh tokens for subsequent API calls.
Storefront SDK Usage
SDK Method: sdk.auth.loginWithPassword()
Example:
typescript
// Login with email and password
const { data, error } = await sdk.auth.loginWithPassword({
email: "customer@example.com",
password: "securePassword123"
});
if (error) {
console.error("Password login failed:", error.message);
} else {
console.log("Login successful:", data.user.email);
console.log("Access token:", data.access_token);
}TypeScript Definition
typescript
"login-with-password": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": {
/** @description User's phone number. */
phone: string;
/**
* @description Two-letter code begin with a plus sign prefix that identifies different countries. By default it will be +91 if not provided.
* Use this key along with phone. Not necessary for email.
* @default +91
*/
country_code?: string;
/** @description The password associated with the user's account. */
password: string;
} | {
email: string;
password: string;
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
/** @description A descriptive message confirming the success or failure of the Login process. */
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 Information about the user, including their name, email, profile image, etc. */
user: components["schemas"]["User"];
/** @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"];
404: components["responses"]["NotFound"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["schemas"]["User"] | User |
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["NotFound"] | NotFound |
Request Body
Content Types: application/json
Responses
200
OK
400
Bad request
401
Not authorized for given operation on the Resource
404
Requested resource not found
OpenAPI Definition
json
{
"tags": [
"Auth"
],
"operationId": "login-with-password",
"summary": "Login with password",
"description": "This API endpoint allows users to Login using their password. It requires the following parameters: email/phone and password. Also allows users to securely Login and obtain access and refresh tokens for subsequent API calls.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/login-with-password",
"description": "API reference for the login-with-password operation"
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"oneOf": [
{
"required": [
"phone",
"password"
],
"title": "phone",
"properties": {
"phone": {
"description": "User's phone number.",
"type": "string"
},
"country_code": {
"description": "Two-letter code begin with a plus sign prefix that identifies different countries. By default it will be +91 if not provided.\nUse this key along with phone. Not necessary for email.",
"type": "string",
"default": "+91"
},
"password": {
"description": "The password associated with the user's account.",
"type": "string"
}
}
},
{
"required": [
"email",
"password"
],
"title": "email",
"properties": {
"email": {
"type": "string"
},
"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 Login process.",
"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": {
"user": {
"description": "Information about the user, including their name, email, profile image, etc.",
"$ref": "#/components/schemas/User"
},
"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": [
"user",
"access_token",
"refresh_token"
],
"type": "object"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "auth",
"x-speakeasy-ignore": true,
"x-speakeasy-name-override": "loginWithPassword"
}Auto-generated from OpenAPI spec and TypeScript definitions