Approve an OAuth authorization request
Called by the consent page with the signed-in user’s decision. decision defaults to approve, which mints an authorization code and returns the client’s redirect URI with code and state appended. decision=deny validates the client and redirect URI the same way, creates no code, and returns the redirect URI with error=access_denied and state. An empty scope means all of the client’s allowed scopes; a scope outside the client’s allowed list redirects with error=invalid_scope. A client owned by another tenant returns 403. nonce is echoed into the id_token. The browser navigates to redirect_url either way. Every redirect carries iss, the issuer URL. client_id may be a client ID metadata document URL, which must already have been loaded through the preview. resource, when given, must be an absolute https URL.
curl --request POST \
--url https://api.costgraph.ai/api/v1/oauth/authorize \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"client_id": "<string>",
"code_challenge": "<string>",
"code_challenge_method": "<string>",
"redirect_uri": "<string>",
"tenant_id": "<string>",
"nonce": "<string>",
"resource": "<string>",
"scope": "<string>",
"state": "<string>"
}
'import requests
url = "https://api.costgraph.ai/api/v1/oauth/authorize"
payload = {
"client_id": "<string>",
"code_challenge": "<string>",
"code_challenge_method": "<string>",
"redirect_uri": "<string>",
"tenant_id": "<string>",
"nonce": "<string>",
"resource": "<string>",
"scope": "<string>",
"state": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
client_id: '<string>',
code_challenge: '<string>',
code_challenge_method: '<string>',
redirect_uri: '<string>',
tenant_id: '<string>',
nonce: '<string>',
resource: '<string>',
scope: '<string>',
state: '<string>'
})
};
fetch('https://api.costgraph.ai/api/v1/oauth/authorize', 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.costgraph.ai/api/v1/oauth/authorize",
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([
'client_id' => '<string>',
'code_challenge' => '<string>',
'code_challenge_method' => '<string>',
'redirect_uri' => '<string>',
'tenant_id' => '<string>',
'nonce' => '<string>',
'resource' => '<string>',
'scope' => '<string>',
'state' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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.costgraph.ai/api/v1/oauth/authorize"
payload := strings.NewReader("{\n \"client_id\": \"<string>\",\n \"code_challenge\": \"<string>\",\n \"code_challenge_method\": \"<string>\",\n \"redirect_uri\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"nonce\": \"<string>\",\n \"resource\": \"<string>\",\n \"scope\": \"<string>\",\n \"state\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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))
}HttpResponse<String> response = Unirest.post("https://api.costgraph.ai/api/v1/oauth/authorize")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"client_id\": \"<string>\",\n \"code_challenge\": \"<string>\",\n \"code_challenge_method\": \"<string>\",\n \"redirect_uri\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"nonce\": \"<string>\",\n \"resource\": \"<string>\",\n \"scope\": \"<string>\",\n \"state\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/oauth/authorize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"client_id\": \"<string>\",\n \"code_challenge\": \"<string>\",\n \"code_challenge_method\": \"<string>\",\n \"redirect_uri\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"nonce\": \"<string>\",\n \"resource\": \"<string>\",\n \"scope\": \"<string>\",\n \"state\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"redirect_url": "<string>"
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}Authorizations
Enter "Bearer {token}"
Body
Authorization request
43 - 128approve, deny 256Was this page helpful?
curl --request POST \
--url https://api.costgraph.ai/api/v1/oauth/authorize \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"client_id": "<string>",
"code_challenge": "<string>",
"code_challenge_method": "<string>",
"redirect_uri": "<string>",
"tenant_id": "<string>",
"nonce": "<string>",
"resource": "<string>",
"scope": "<string>",
"state": "<string>"
}
'import requests
url = "https://api.costgraph.ai/api/v1/oauth/authorize"
payload = {
"client_id": "<string>",
"code_challenge": "<string>",
"code_challenge_method": "<string>",
"redirect_uri": "<string>",
"tenant_id": "<string>",
"nonce": "<string>",
"resource": "<string>",
"scope": "<string>",
"state": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
client_id: '<string>',
code_challenge: '<string>',
code_challenge_method: '<string>',
redirect_uri: '<string>',
tenant_id: '<string>',
nonce: '<string>',
resource: '<string>',
scope: '<string>',
state: '<string>'
})
};
fetch('https://api.costgraph.ai/api/v1/oauth/authorize', 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.costgraph.ai/api/v1/oauth/authorize",
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([
'client_id' => '<string>',
'code_challenge' => '<string>',
'code_challenge_method' => '<string>',
'redirect_uri' => '<string>',
'tenant_id' => '<string>',
'nonce' => '<string>',
'resource' => '<string>',
'scope' => '<string>',
'state' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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.costgraph.ai/api/v1/oauth/authorize"
payload := strings.NewReader("{\n \"client_id\": \"<string>\",\n \"code_challenge\": \"<string>\",\n \"code_challenge_method\": \"<string>\",\n \"redirect_uri\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"nonce\": \"<string>\",\n \"resource\": \"<string>\",\n \"scope\": \"<string>\",\n \"state\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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))
}HttpResponse<String> response = Unirest.post("https://api.costgraph.ai/api/v1/oauth/authorize")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"client_id\": \"<string>\",\n \"code_challenge\": \"<string>\",\n \"code_challenge_method\": \"<string>\",\n \"redirect_uri\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"nonce\": \"<string>\",\n \"resource\": \"<string>\",\n \"scope\": \"<string>\",\n \"state\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/oauth/authorize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"client_id\": \"<string>\",\n \"code_challenge\": \"<string>\",\n \"code_challenge_method\": \"<string>\",\n \"redirect_uri\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"nonce\": \"<string>\",\n \"resource\": \"<string>\",\n \"scope\": \"<string>\",\n \"state\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"redirect_url": "<string>"
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}