Skip to main content

Get token

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

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

ParameterCLI optionTypeRequiredDescription
Code--codeStringCode obtained from authorization See GetAuthorizationLink
Parameters--authStructure Of StringAuthorization data. See GetStandardParameters

Returns: Map Of KeyAndValue - serialized JSON response from Twitter


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

Result = OPI_Twitter.GetToken(Code, Parameters);
    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':'***'}"
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"
}