1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2024-12-21 01:50:24 +02:00
OpenIntegrations/docs/en/md/Bitrix24/Settings-and-administartion/Get-token.md

49 lines
1.2 KiB
Markdown
Raw Normal View History

---
sidebar_position: 2
---
# Get token
Get token by auth code
2024-07-10 12:58:29 +02:00
`Function GetToken(Val ClientID, Val ClientSecret, Val Code) Export`
| Parameter | CLI option | Type | Description |
|-|-|-|-|
| ClientID | --clientid | String | Client ID from app settings |
| ClientSecret | --clientsecret | String | Client secret from app settings |
| Code | --code | String | Code from browser auth page |
Returns: Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
2024-07-10 13:05:58 +02:00
<br/>
2024-07-10 12:58:29 +02:00
```bsl title="Code example"
2024-08-13 15:47:32 +02:00
ClientID = "local.6667fc928a50a9.70414732";
ClientSecret = "ZeKyeYIgy2NsHZqsIHY6GfG1V...";
Code = "2b096866006e9f06006b12e400000001000007fc1bc681f7ed7f13f2d449980628008c";
Result = OPI_Bitrix24.GetToken(ClientID, ClientSecret, Code);
```
```sh title="CLI command example"
oint bitrix24 GetToken --clientid "local.6667fc928a50a9.70414732" --clientsecret "ZeKyeYIgy2NsHZqsIHY6GfG1V..." --code "2b096866006e9f06006b12e400000001000007fc1bc681f7ed7f13f2d449980628008c"
```
```json title="Result"
2024-08-13 15:49:40 +02:00
{
"error": "expired_token",
"error_description": "The authorization token provided has expired."
}
2024-08-13 15:49:40 +02:00
```