Skip to main content

Convert code to token

Converts the code to a token after entering the code when executing GetConfirmationCode

Function ConvertCodeToToken(Val ClientId, Val ClientSecret, Val DeviceCode) Export

ParameterCLI optionTypeRequiredDescription
ClientId--idStringClient id
ClientSecret--secretStringClient secret
DeviceCode--deviceStringdevice_code from GetConfirmationCode
Returns

Map Of KeyAndValue - serialized JSON response from Yandex

1C:Enterprise/OneScript code example
ClientID = "cc2ce9d60deb4975be58866d32dbe7aa";
ClientSecret = "7cc0b903d33e41c1...";
DeviceCode = "12345678";

Result = OPI_YandexDisk.ConvertCodeToToken(ClientID, ClientSecret, DeviceCode);
oint yadisk ConvertCodeToToken \
--id "cc2ce9d60deb4975be58866d32dbe7aa" \
--secret "***" \
--device "12345678"
Result
{
"error": "invalid_grant",
"error_description": "Code has expired"
}