Add Bearer authorization
Adds a request header for Bearer authorization
Function AddBearerAuthorization(Val Token) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Token | --token | String | ✔ | Bearer token value |
Returns: DataProcessorObject.OPI_HTTPClient - This processor object
1C:Enterprise/OneScript code example
URL = "https://bin.openintegrations.dev";
URL = URL + "/get";
Result = OPI_HTTPRequests.NewRequest()
.Initialize()
.SetURL(URL)
.AddBearerAuthorization("123123") // <---
.ProcessRequest("GET")
.ReturnResponseAsJSONObject();
Result
{
"args": {},
"headers": {
"Accept": "*/*",
"Accept-Charset": "utf-8",
"Accept-Encoding": "gzip",
"Authorization": "Bearer 123123",
"Connection": "Keep-Alive",
"Content-Length": "0",
"Host": "localhost:2424",
"Max-Forwards": "10",
"User-Agent": "1Script v$2.0.0.0",
"X-Arr-Log-Id": "5025c142-a51d-402a-bbed-d1fae175d4f6",
"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"
}