1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-11-25 22:12:29 +02:00
Files
OpenIntegrations/docs/en/md/HTTP-client/Authorization/Add-o-auth-v1-authorization.mdx
Vitaly the Alpaca (bot) f770866203 Main build (Jenkins)
2025-10-05 19:19:32 +03:00

73 lines
2.3 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=\"1757937895\",oauth_nonce=\"1757937895\",oauth_version=\"1.0\",oauth_signature=oY5o4eEWpU%2BbLdAlTUn6NLu9LJfxCEVtiAOVoCs3rko%3D",
"Content-Length": "0",
"Host": "httpbin.org",
"User-Agent": "1Script v$2.0.0.0",
"X-Amzn-Trace-Id": "Root=1-68c7e4c7-05efc96808d7c66455034513"
},
"origin": "***",
"url": "https://httpbin.org/get"
}
```