Get the text token to enter MyChat Services: forum, Kanban, chat, or Admin Panel.

 

Syntax


{
 "cmd"        : "0016",
 "ServerKey"  : "iddqd",
 "APIStype"   : "mydata",
 
 "UIN"        : 18,
 "Pass":      : "jkjGHKsjxg12",
 "Email"      : "user@mail.com",
 "Nick"       : "John_Smith",
 "Domain"     : "",
 "Style"      : 0,
 "Where"      : "chat"
}


Parameters

Parameter

Type

Value

cmd

string

"0016", number of the command MCIAPI_CS_GetLoginToken;

ServerKey

string

IntegrationAPI key that is set in server settings;

APIStype

string

integration type. Set any string;

UIN

integer

user numeric identifier; unnecessary;

Pass

string

user's account password (necessary parameter). If you use an authorization without password — just an empty string;

Email

string

аuser email address (unnecessary). Can be used for identification;

Nick

string

user login (unnecessary). Can be used for identification;

Domain

string

user domain name that is used for domain authentication;

AuthType

integer

user authentication type (necessary parameter);

Where

string

chat service, where you will be using a token. Possible variants:: "kanban", "forum", "admin" and "chat".

 

Work result


{
  "cmd"   : "0016",
  "UIN"   : 18,
  "Where" : "chat"
  "Token" : "GJmsnbsdjUsdfbiHHksdfksjdfHGjerusmdMgjhgfdsIYT"
}


Field

Type

Value

Cmd

integer

command number that was successfully executed (HEX 0016);

Where

string

token type (in what MyChat service it will be used);

Token

string

token, text string with large and small letters and numbers.

 

Example

Example of how to get a token to enter web-chat with the help of JavaScript in a browser.


var req = new XMLHttpRequest();
req.open('POST', "/API/", true);
req.send(JSON.stringify({
    apiCMD   : '1006',
    cmd      : "0016",
    Pass     : "password",
    UIN      : "3",
    Style    : 0,
    Where    : "chat",
    ServerKey: "iddqd",
    APIStype : "blah-blah-blaah"
}) + "\r\n");
req.onreadystatechange = function(){
    if(req.readyState == XMLHttpRequest.DONE && req.status === 200) {
        console.log(req.responseText);
    }
};
{"cmd":"0016","UIN":"3","apiCMD":"1006","ServerKey":"iddqd","Where":"chat",
"Token":"J56sHTtShyhAdZGpgVJE51tW3TDxGhhreGWxovkEIBWFqDwqXtgLg066urBnmAJe",
"hash":"VimSvpWFWg83Z6H","APIStype":"blah-blah-blaah","Pass":"password",
"Style":0,"CMD":"6"}


 

Get token to access WEB chat MyChat from JavaScript

 

Then take a received token and enter a browser:

 

Entering MyChat in a browser by token

 

Possible errors

MCIAPI_Error_WrongAuthData