MngCreateLeadLoginLink¶
Creates a one-time link that opens the trading terminal signed in as one lead, without the lead's password. The manager opens the link in a browser, and the terminal exchanges the code from the link for a customer session through AuthCustomerByCode.
The command is available through the manager command API only; there is no REST
path for it. The kind is fixed by the command name, so customer_kind is not
accepted on input. The client counterpart is
MngCreateClientLoginLink. See
Clients and Leads Commands.
The link:
- has the form
https://<terminal_host>/<language>/platform?code=<code>, whereterminal_hostis taken from the lead's brand andlanguageis the lead'spreferred_language, then the branddefault_language, thenen; - contains a 64-character code that is valid for
expires_inseconds (60); - can be used once. The first exchange attempt consumes the code, whether it succeeds or not;
- is a secret. The server keeps only a hash of the code, and the
login_urlvalue is masked in the journal.
The session created from the link is a full customer session: everything the lead can do in the terminal is available. It differs from a normal sign-in in three ways:
- it carries
impersonated_bywith the manager id, and every journaled action in it recordsimpersonated_byin the journaldetail; - it expires 4 hours after the exchange. An open WebSocket connection receives
session.updatewithaction: logoutand is closed; - it does not change the lead's
last_login_time.
The lead is not notified.
Access Control¶
Allowed sessions:
SESSION_MANAGERSESSION_ADMINSESSION_DEALERSESSION_CRM_MANAGERSESSION_CRM_ADMIN
The caller must have CRM access and login_as_leads. The record brand and
desk must be inside the manager scope; admin scope bypasses this check. Every
call is journaled.
The lead must be enabled, have at least one trading account, and belong to an
active, enabled brand that is available for the API and has a terminal_host.
Request¶
{
"command": "MngCreateLeadLoginLink",
"extID": "1",
"data": {
"customer_id": 1
}
}
Request Data¶
| Field | Type | Required | Description |
|---|---|---|---|
customer_id |
int | Yes | Target customer id, 1 or greater |
Response Data¶
{
"customer_id": 1,
"login_url": "https://terminal.example.com/en/platform?code=3f9c1e0b7a6d5c4b3a291807f6e5d4c3b2a1908f7e6d5c4b3a2918070f6e5d4c",
"expires_in": 60
}
| Field | Type | Description |
|---|---|---|
customer_id |
int | Target customer id |
login_url |
string | One-time terminal link; open it in a browser |
expires_in |
int | Lifetime of the code in the link, seconds |
Errors¶
| HTTP | Error | Description |
|---|---|---|
400 |
INVALID_DATA |
Request validation failed |
400 |
RET_INVALID_DATA |
The customer exists but is not a lead, or the link cannot be built (invalid language value, too many outstanding codes) |
400 |
CUSTOMER_HAS_NO_ACCOUNTS |
The lead has no trading accounts |
403 |
RET_NOT_ENOUGH_RIGHTS |
Missing permission, missing scope, or the record is outside the caller's visibility |
403 |
CUSTOMER_DISABLED |
The lead is disabled |
403 |
BRAND_NOT_AVAILABLE |
The lead's brand is inactive, disabled, not available for the API, or has no terminal_host |
404 |
RET_NOT_FOUND |
No customer with that identifier exists |
Every error carries a message field with free-form text. Its contents are not
part of the contract; branch on error.