Exchange client credentials for an access token.
curl --request POST \
--url https://api.secfix.com/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data client_id=aB3xY7... \
--data client_secret=s3cr3t... \
--data grant_type=client_credentialsimport requests
url = "https://api.secfix.com/oauth/token"
payload = {
"client_id": "aB3xY7...",
"client_secret": "s3cr3t...",
"grant_type": "client_credentials"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
client_id: 'aB3xY7...',
client_secret: 's3cr3t...',
grant_type: 'client_credentials'
})
};
fetch('https://api.secfix.com/oauth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.secfix.com/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "client_id=aB3xY7...&client_secret=s3cr3t...&grant_type=client_credentials",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.secfix.com/oauth/token"
payload := strings.NewReader("client_id=aB3xY7...&client_secret=s3cr3t...&grant_type=client_credentials")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.secfix.com/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("client_id=aB3xY7...&client_secret=s3cr3t...&grant_type=client_credentials")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.secfix.com/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "client_id=aB3xY7...&client_secret=s3cr3t...&grant_type=client_credentials"
response = http.request(request)
puts response.read_body{
"access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6...",
"expires_in": 86400,
"token_type": "Bearer"
}{
"code": "not_found",
"detail": "No asset found for the given id.",
"instance": "/v1/inventory/assets/3f1c9a2e-8b4d-4e7a-9c1f-2a5b6c7d8e9f",
"requestId": "req_01HZY8Q3M4N5P6R7S8T9V0W1X2",
"status": 404,
"title": "Not Found",
"type": "https://api.secfix.com/problems/not_found"
}{
"code": "not_found",
"detail": "No asset found for the given id.",
"instance": "/v1/inventory/assets/3f1c9a2e-8b4d-4e7a-9c1f-2a5b6c7d8e9f",
"requestId": "req_01HZY8Q3M4N5P6R7S8T9V0W1X2",
"status": 404,
"title": "Not Found",
"type": "https://api.secfix.com/problems/not_found"
}{
"code": "not_found",
"detail": "No asset found for the given id.",
"instance": "/v1/inventory/assets/3f1c9a2e-8b4d-4e7a-9c1f-2a5b6c7d8e9f",
"requestId": "req_01HZY8Q3M4N5P6R7S8T9V0W1X2",
"status": 404,
"title": "Not Found",
"type": "https://api.secfix.com/problems/not_found"
}OAuth
Exchange client credentials for an access token.
OAuth 2.0 client_credentials grant. Send form-urlencoded grant_type=client_credentials, client_id and client_secret. Returns a bearer access token for the Secfix Public API audience.
POST
/
oauth
/
token
Exchange client credentials for an access token.
curl --request POST \
--url https://api.secfix.com/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data client_id=aB3xY7... \
--data client_secret=s3cr3t... \
--data grant_type=client_credentialsimport requests
url = "https://api.secfix.com/oauth/token"
payload = {
"client_id": "aB3xY7...",
"client_secret": "s3cr3t...",
"grant_type": "client_credentials"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
client_id: 'aB3xY7...',
client_secret: 's3cr3t...',
grant_type: 'client_credentials'
})
};
fetch('https://api.secfix.com/oauth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.secfix.com/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "client_id=aB3xY7...&client_secret=s3cr3t...&grant_type=client_credentials",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.secfix.com/oauth/token"
payload := strings.NewReader("client_id=aB3xY7...&client_secret=s3cr3t...&grant_type=client_credentials")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.secfix.com/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("client_id=aB3xY7...&client_secret=s3cr3t...&grant_type=client_credentials")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.secfix.com/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "client_id=aB3xY7...&client_secret=s3cr3t...&grant_type=client_credentials"
response = http.request(request)
puts response.read_body{
"access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6...",
"expires_in": 86400,
"token_type": "Bearer"
}{
"code": "not_found",
"detail": "No asset found for the given id.",
"instance": "/v1/inventory/assets/3f1c9a2e-8b4d-4e7a-9c1f-2a5b6c7d8e9f",
"requestId": "req_01HZY8Q3M4N5P6R7S8T9V0W1X2",
"status": 404,
"title": "Not Found",
"type": "https://api.secfix.com/problems/not_found"
}{
"code": "not_found",
"detail": "No asset found for the given id.",
"instance": "/v1/inventory/assets/3f1c9a2e-8b4d-4e7a-9c1f-2a5b6c7d8e9f",
"requestId": "req_01HZY8Q3M4N5P6R7S8T9V0W1X2",
"status": 404,
"title": "Not Found",
"type": "https://api.secfix.com/problems/not_found"
}{
"code": "not_found",
"detail": "No asset found for the given id.",
"instance": "/v1/inventory/assets/3f1c9a2e-8b4d-4e7a-9c1f-2a5b6c7d8e9f",
"requestId": "req_01HZY8Q3M4N5P6R7S8T9V0W1X2",
"status": 404,
"title": "Not Found",
"type": "https://api.secfix.com/problems/not_found"
}Body
application/x-www-form-urlencoded
OAuth 2.0 client-credentials token request (form-urlencoded).