You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-11-25 22:12:29 +02:00
78 lines
2.5 KiB
Plaintext
Vendored
78 lines
2.5 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 4
|
|
description: Add OAuth V1 authorization and other functions to work with HTTP-client in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
|
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, HTTP-client]
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# Add OAuth V1 authorization
|
|
Adds data for OAuth v1 authorization
|
|
|
|
|
|
|
|
`Function AddOAuthV1Authorization(Val Token, Val Secret, Val ConsumerKey, Val ConsumerSecret, Val Version) Export`
|
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|-|-|-|-|-|
|
|
| Token | --token | String | ✔ | Token for authorization |
|
|
| Secret | --secret | String | ✔ | Secret for authorization |
|
|
| ConsumerKey | --ck | String | ✔ | Consumer key for authorization |
|
|
| ConsumerSecret | --cs | String | ✔ | Consumer secret for authorization |
|
|
| Version | --ver | String | ✔ | API version |
|
|
|
|
|
|
Returns: DataProcessorObject.OPI_HTTPClient - This processor object
|
|
|
|
<br/>
|
|
|
|
:::tip
|
|
By default, HMAC-SHA256 is used to create the signature. To change the algorithm, you can use `SetOAuthV1Algorithm`
|
|
:::
|
|
<br/>
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
URL = "https://bin.openintegrations.dev";
|
|
URL = URL + "/get";
|
|
|
|
Token = "***";
|
|
Secret = "***";
|
|
UsersKey = "***";
|
|
UsersSecret = "***";
|
|
Version = "1.0";
|
|
|
|
Result = OPI_HTTPRequests.NewRequest()
|
|
.Initialize(URL)
|
|
.AddOAuthV1Authorization(Token, Secret, UsersKey, UsersSecret, Version) // <---
|
|
.ProcessRequest("GET")
|
|
.ReturnResponseAsJSONObject();
|
|
```
|
|
|
|
|
|
|
|
|
|
```json title="Result"
|
|
{
|
|
"args": {},
|
|
"headers": {
|
|
"Accept": "*/*",
|
|
"Accept-Charset": "utf-8",
|
|
"Accept-Encoding": "gzip",
|
|
"Authorization": "OAuth oauth_consumer_key=\"***\",oauth_token=\"***\",oauth_signature_method=\"HMAC-SHA256\",oauth_timestamp=\"1761854741\",oauth_nonce=\"1761854741\",oauth_version=\"1.0\",oauth_signature=apHr%2BD5Y1MZlN0evK6sMjMHcLzopBvikffiXBHysfdw%3D",
|
|
"Connection": "Keep-Alive",
|
|
"Content-Length": "0",
|
|
"Host": "localhost:2424",
|
|
"Max-Forwards": "10",
|
|
"User-Agent": "1Script v$2.0.0.0",
|
|
"X-Arr-Log-Id": "4cf87154-a0ea-4585-a7ce-7644cfdd61ae",
|
|
"X-Arr-Ssl": "2048|256|C=BE, O=GlobalSign nv-sa, CN=GlobalSign GCC R6 AlphaSSL CA 2025|CN=*.openintegrations.dev",
|
|
"X-Forwarded-Host": "bin.openintegrations.dev",
|
|
"X-Original-Url": "/get"
|
|
},
|
|
"origin": "***",
|
|
"url": "https://bin.openintegrations.dev/get"
|
|
}
|
|
```
|