2025-05-08 09:05:34 +03:00
---
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
2025-05-09 00:04:38 +03:00
`Function AddOAuthV1Authorization(Val Token, Val Secret, Val ConsumerKey, Val ConsumerSecret, Val Version) Export`
2025-05-08 09:05:34 +03:00
| 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"
2025-09-23 15:45:00 +03:00
URL = "http://localhost:2424";
2025-05-09 21:49:23 +03:00
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();
2025-05-08 09:05:34 +03:00
```
2025-05-21 08:49:49 +03:00
```json title="Result"
{
"args": {},
"headers": {
"Accept": "*/*",
"Accept-Charset": "utf-8",
"Accept-Encoding": "gzip",
2025-09-15 13:14:53 +03:00
"Authorization": "OAuth oauth_consumer_key=\"***\",oauth_token=\"***\",oauth_signature_method=\"HMAC-SHA256\",oauth_timestamp=\"1757937895\",oauth_nonce=\"1757937895\",oauth_version=\"1.0\",oauth_signature=oY5o4eEWpU%2BbLdAlTUn6NLu9LJfxCEVtiAOVoCs3rko%3D",
"Content-Length": "0",
2025-05-21 08:49:49 +03:00
"Host": "httpbin.org",
2025-09-15 13:14:53 +03:00
"User-Agent": "1Script v$2.0.0.0",
"X-Amzn-Trace-Id": "Root=1-68c7e4c7-05efc96808d7c66455034513"
2025-05-21 08:49:49 +03:00
},
"origin": "***",
"url": "https://httpbin.org/get"
}
```