---
sidebar_position: 2
description: Get token and other functions to work with Bitrix24 in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Bitrix24]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Get token
 Get token by auth code



`Function GetToken(Val ClientID, Val ClientSecret, Val Code) Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | ClientID | --clientid | String | &#x2714; | Client ID from app settings |
  | ClientSecret | --clientsecret | String | &#x2714; | Client secret from app settings |
  | Code | --code | String | &#x2714; | Code from browser auth page |

  
  Returns:  Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API



```bsl title="1C:Enterprise/OneScript code example"
    ClientID     = "local.6667fc928a50a9.70414732";
    ClientSecret = "ZeKyeYIgy2NsHZqsIHY6GfG1V...";
    Code         = "2b096866006e9f06006b12e400000001000007fc1bc681f7ed7f13f2d449980628008c";

    Result = OPI_Bitrix24.GetToken(ClientID, ClientSecret, Code);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            oint bitrix24 GetToken \
             --clientid "***" \
             --clientsecret "***" \
             --code "2b096866006e9f06006b12e400000001000007fc1bc681f7ed7f13f2d449980628008c"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            oint bitrix24 GetToken ^
             --clientid "***" ^
             --clientsecret "***" ^
             --code "2b096866006e9f06006b12e400000001000007fc1bc681f7ed7f13f2d449980628008c"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "error": "expired_token",
 "error_description": "The authorization token provided has expired."
}
```
