Get token
Get token by auth code
- Parameters
- Advanced call ?
Function GetToken(Val ClientID, Val ClientSecret, Val Code) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| ClientID | --clientid | String | ✔ | Client ID from app settings |
| ClientSecret | --clientsecret | String | ✔ | Client secret from app settings |
| Code | --code | String | ✔ | Code from browser auth page |
Returns
Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
| Parameter | Description |
|---|---|
| proxy | InternetProxy or a structure with fields Protocol, Host, Port, User, Password, UseOSAuthentication |
| timeout | Request execution timeout |
| adv_response | Formats the response as a complete HTTP structure with fields code, body, and headers |
| retries | Number of HTTP request send attempts on 5** status codes or internal client errors |
| dontwait | Creates a background job and returns its data (for 1C and OneScript only) |
1C:Enterprise/OneScript code example
ClientID = "local.6667fc928a50a9.70414732";
ClientSecret = "ZeKyeYIgy2NsHZqsIHY6GfG1V...";
Code = "2b096866006e9f06006b12e400000001000007fc1bc681f7ed7f13f2d449980628008c";
Result = OPI_Bitrix24.GetToken(ClientID, ClientSecret, Code);
- Bash
- CMD/Bat
oint bitrix24 GetToken \
--clientid "***" \
--clientsecret "***" \
--code "2b096866006e9f06006b12e400000001000007fc1bc681f7ed7f13f2d449980628008c"
oint bitrix24 GetToken ^
--clientid "***" ^
--clientsecret "***" ^
--code "2b096866006e9f06006b12e400000001000007fc1bc681f7ed7f13f2d449980628008c"
Result
{
"error": "expired_token",
"error_description": "The authorization token provided has expired."
}