Skip to main content

Get token by code

Gets token by code from browser authorization

Function GetTokenByCode(Val ClientID, Val ClientSecret, Val Code) Export

ParameterCLI optionTypeRequiredDescription
ClientID--idStringClient ID
ClientSecret--secretStringClient secret
Code--codeStringCode from browser
Returns

Map Of KeyAndValue - serialized JSON response from Google

1C:Enterprise/OneScript code example
ClientID = "345925493105-641q49rl4oflrtr46fkgqf5upiltr4bg.apps.googleusercontent.com";
ClientSecret = "GOCSPX-v--MJyEjtV...";
Code = "4/0AeaYSHBDZAbAtChyjMxPKa0DXIilJYYcVCgKYzA_CPmCPSt1mg_KqxI4w5CP3lTlYibpGg";

Result = OPI_GoogleCalendar.GetTokenByCode(ClientID, ClientSecret, Code);
oint gcalendar GetTokenByCode \
--id "345925493105-641q49rl4oflrtr46fkgqf5upiltr4bg.apps.googleusercontent.com" \
--secret "***" \
--code "4/0AeaYSHBDZAbAtChyjMxPKa0DXIilJYYcVCgKYzA_CPmCPSt1mg_KqxI4w5CP3lTlYibpGg"
Result
{
"error": "invalid_grant",
"error_description": "Bad Request"
}