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);
    # JSON data can also be passed as a path to a .json file

oint twitter GetToken \
--code "123456" \
--auth "{'redirect_uri':'https://api.athenaeum.digital/opi/hs/twitter','client_id':'***','client_secret':'***','access_token':'***','refresh_token':'***','oauth_token':'***','oauth_token_secret':'***','oauth_consumer_key':'***','oauth_consumer_secret':'***'}"
Result
{
"error": "invalid_request",
"error_description": "Value passed for the authorization code was invalid."
}