---
sidebar_position: 2
description: Get token and other functions to work with Twitter 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, Twitter]
---

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

# Get token
 Gets the token by the code received when authorizing using the link from GetAuthorizationLink



`Function GetToken(Val Code, Val Parameters = "") Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | Code | --code | String | &#x2714; | Code obtained from authorization See GetAuthorizationLink |
  | Parameters | --auth | Structure Of String | &#x2716; | Authorization data. See GetStandardParameters |

  
  Returns:  Map Of KeyAndValue - serialized JSON response from Twitter



```bsl title="1C:Enterprise/OneScript code example"
    Parameters = GetTwitterAuthData();
    Code       = "123456";

    Result = OPI_Twitter.GetToken(Code, Parameters);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint twitter GetToken \
             --code "123456" \
             --auth "{'redirect_uri':'https://hut.openintegrations.dev/melezh/6ad91cc8b','client_id':'***','client_secret':'***','access_token':'***','refresh_token':'***','oauth_token':'***','oauth_token_secret':'***','oauth_consumer_key':'***','oauth_consumer_secret':'***'}"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            :: JSON data can also be passed as a path to a .json file
            
            oint twitter GetToken ^
             --code "123456" ^
             --auth "{'redirect_uri':'https://hut.openintegrations.dev/melezh/6ad91cc8b','client_id':'***','client_secret':'***','access_token':'***','refresh_token':'***','oauth_token':'***','oauth_token_secret':'***','oauth_consumer_key':'***','oauth_consumer_secret':'***'}"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
  "token_type": "bearer",
  "expires_in": 7200,
  "access_token": "ZG53T21jUTZqc01233pHZUNzSWt4VUltSW4xMVhQd0tLR0NDMUgtZlQ3V3FMOjE3NTczMTg1MTI0MDA6MTowOmF0OjE",
  "scope": "mute.write tweet.moderate.write block.read follows.read offline.access list.write bookmark.read list.read tweet.write space.read block.write like.write like.read users.read tweet.read bookmark.write mute.read follows.write",
  "refresh_token": "T21qZGlHenVTNTA1rwgxalNHMERScENOTmIzWlFCdXBUNmwwWHduUUdoUjh6OjE3NTczMTg1MTI0MDA6MTowOnJ0OjE"
 }
```
