Properties
HTTP request properties:
➢Authorization Protocol: OAuth 2.0 - Client Credentials Grant Type
➢Access Token Endpoint: https://{host}:8061/binetix/oauth/token
➢Request Methods: GET, POST (recommended)
➢Client Authorization: Basic Authorization (recommended), Credentials in body
Notes:
✓In HTTPS mode with POST method you can encrypt all input parameter of the HTTP request as a standard form-based values.
✓The Client's credentials can be provided with the rest of the input fields within the HTTP request body as a standard form-based values.
✓By default, the Authorization Server is using self-signed certificate over HTTPS. |
References
Implementation Guide
The recommended service properties are used in the code samples below under localhost.
Step 1: Send a request to retrieve new access token:
HTTP Request URI
https://localhost:8061/binetix/oauth/token
|
HTTP Request Header (POST)
POST /binetix/oauth/token HTTP/1.1
Host: localhost:8061
Accept: application/json
Content-Type: application/x-www-form-urlencoded
Content-Length: 40
Authorization: Basic cHRtOjEyMzQ1Njc4OQ==
Pragma: no-cache
Cache-Control: no-cache
|
HTTP Request Body
grant_type=client_credentials&scope=spmm
|
Step 2: Check-out the response:
HTTP Response Header
HTTP/1.1 200 OK
Date: Sun, 13 Dec 2020 16:05:39 GMT
X-Powered-By: BINETIX AGE/2021
Content-Length: 81
Content-Type: application/json
Server: BINETIX AGE/2021
Age-Version: 2021
Age-Node: 19795297
Age-Performance-Index: 71241.0564249
|
HTTP Response Body
{
"access_token": "I1x7ORDeP0o6DDDOnAo9",
"expires_in": 259200
"token_type": "bearer"
}
|
Implementation Notes:
•In Basic Authorization mode the Client's credentials (Client ID and Client Secret) are encoded in BASE64 in accordance with RFC 2617, Section 2.
•The access token is generated in accordance with RFC 6750 and can be directly used as a string sequence in the header of all JSON-RPC Methods and Direct Invocations.
•The access token's lifetime is calculated in seconds. The default value is 259200 sec. (eq. 72h or 3 full astronomical days). |
Configuration Samples & Testing
CURL
C:\> curl.exe --insecure --url "https://localhost:8061/binetix/oauth/token?grant_type=client_credentials&scope=spmm" -H "Authorization: Basic cHRtOjEyMzQ1Njc4OQ=="
{"access_token":"gX2GheXX5fLpAsly38Vb","expires_in":259200,"token_type":"bearer"}
|
PowerShell (version 6 or above)
PS C:\> (Get-Host).Version
Major Minor Build Revision
----- ----- ----- --------
7 1 0 -1
PS C:\> (Invoke-WebRequest -SkipCertificateCheck -Uri 'https://localhost:8061/binetix/oauth/token?grant_type=client_credentials&scope=spmm' -Method 'POST' -Headers @{'Authorization' = 'Basic cHRtOjEyMzQ1Njc4OQ=='}).Content
{"access_token":"Jk3xU00s4cs4KPnL6Mv5","expires_in":259200,"token_type":"bearer"}
|
RESTer Plugin for Firefox
|