Post v1openidctoken - Terminal 3 Documentation
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
cURL
curl --request POST \
--url https://staging.terminal3.io/v1/openidc/token \
--header 'Content-Type: application/json' \
--data '
{
"grant_type": "authorization_code",
"code": "<string>",
"client_id": "<string>",
"client_secret": "<string>",
"redirect_uri": "<string>"
}
'
Python
import requests
url = "https://staging.terminal3.io/v1/openidc/token"
payload = {
"grant_type": "authorization_code",
"code": "<string>",
"client_id": "<string>",
"client_secret": "<string>",
"redirect_uri": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
JavaScript (Fetch)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
grant_type: 'authorization_code',
code: '<string>',
client_id: '<string>',
client_secret: '<string>',
redirect_uri: '<string>'
})
};
fetch('https://staging.terminal3.io/v1/openidc/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.terminal3.io/v1/openidc/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 => json_encode([
'grant_type' => 'authorization_code',
'code' => '<string>',
'client_id' => '<string>',
'client_secret' => '<string>',
'redirect_uri' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
Go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://staging.terminal3.io/v1/openidc/token"
payload := strings.NewReader("{\n \"grant_type\": \"authorization_code\",\n \"code\": \"<string>\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"redirect_uri\": \"<string>\"}\")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
Unirest (Java)
HttpResponse<String> response = Unirest.post("https://staging.terminal3.io/v1/openidc/token")
.header("Content-Type", "application/json")
.body("{\n \"grant_type\": \"authorization_code\",\n \"code\": \"<string>\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"redirect_uri\": \"<string>\"}\")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://staging.terminal3.io/v1/openidc/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"grant_type\": \"authorization_code\",\n \"code\": \"<string>\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"redirect_uri\": \"<string>\"}\"
response = http.request(request)
puts response.read_body
Response
Success (200)
{
"scope": "openid",
"token_type": "Bearer",
"access_token": "<string>",
"expire_in": 123,
"id_token": "<string>"
}
Error (400)
{
"error": "<string>",
"error_description": "<string>"
}
Error (500)
{
"error": "<string>",
"error_description": "<string>"
}
Body
application/json
| Parameter | Type | Description |
|---|---|---|
| grant_type | enum |
required |
| code | string | required |
| client_id | string | required |
| client_secret | string | required |
| redirect_uri | string |
required |
Response Fields
| Field | Type | Description |
|---|---|---|
| scope | enum |
required |
| token_type | enum |
required |
| access_token | string | required |
| expire_in | number | required |
| id_token | string | required |