verify-pos-login-otp
Method: POST
Path: /pos/auth/verify-otp
Tags: Authentication
Summary
Verify OTP
Description
Verify POS login otp. Login to POS device using phone. A code is valid for a limited time after it is sent, and is used up after 5 wrong tries; then request a new one. A 400's code says why: otp-expired, otp-attempts-exceeded (the 5th wrong try), or validation-error for a wrong, unknown or already used code. The endpoint requires authentication with an API key that has the scope set to 'storefront' for a particular store.
Pos SDK Usage
SDK Method: pos.verifyOtp()
Example:
typescript
const { data, error } = await pos.verifyOtp({
otp_token: "otp-token-from-login",
otp: "123456",
otp_action: "login"
});
if (error) {
console.error("OTP verification failed:", error.message);
} else {
console.log("Login successful:", data.user);
console.log("Access token:", data.access_token);
console.log("Refresh token:", data.refresh_token);
// Tokens are automatically stored by the SDK
}TypeScript Definition
typescript
"verify-pos-login-otp": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": {
/** @description A string representing the one-time password. */
otp: string;
/** @description A string representing the OTP token. */
otp_token: string;
/**
* @description The action the code was sent for: `login`, the default.
* @default login
* @enum {string}
*/
action?: "login";
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: string;
success: boolean;
content: {
user: components["schemas"]["PosUser"];
access_token: string;
refresh_token: string;
};
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["schemas"]["PosUser"] | PosUser |
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
{
"operationId": "verify-pos-login-otp",
"summary": "Verify OTP",
"description": "Verify POS login otp. Login to POS device using phone. A code is valid for a limited time after it is sent, and is used up after 5 wrong tries; then request a new one. A 400's `code` says why: `otp-expired`, `otp-attempts-exceeded` (the 5th wrong try), or `validation-error` for a wrong, unknown or already used code. The endpoint requires authentication with an API key that has the scope set to 'storefront' for a particular store.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"otp": {
"description": "A string representing the one-time password.",
"type": "string"
},
"otp_token": {
"description": "A string representing the OTP token.",
"type": "string"
},
"action": {
"description": "The action the code was sent for: `login`, the default.",
"type": "string",
"default": "login",
"enum": [
"login"
]
}
},
"required": [
"otp",
"otp_token"
]
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
},
"content": {
"properties": {
"user": {
"$ref": "#/components/schemas/PosUser"
},
"access_token": {
"type": "string"
},
"refresh_token": {
"type": "string"
}
},
"required": [
"user",
"access_token",
"refresh_token"
],
"type": "object"
}
},
"required": [
"message",
"success",
"content"
]
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
}
},
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/verify-pos-login-otp",
"description": "API reference for the verify-pos-login-otp operation"
},
"security": [
{
"X-Api-Key": []
}
],
"tags": [
"Authentication"
],
"x-speakeasy-group": "pos",
"x-speakeasy-name-override": "verifyOtp"
}Auto-generated from OpenAPI spec and TypeScript definitions