Approve authorization and generate code
curl --request POST \
--url https://api.example.com/oauth/authorize/approve \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"clientId": "app_abc123...",
"redirectUri": "https://example.com/oauth/callback",
"scopes": [
"read:user",
"read:organization"
],
"state": "random_state_abc123",
"codeChallenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
"codeChallengeMethod": "S256"
}
'import requests
url = "https://api.example.com/oauth/authorize/approve"
payload = {
"clientId": "app_abc123...",
"redirectUri": "https://example.com/oauth/callback",
"scopes": ["read:user", "read:organization"],
"state": "random_state_abc123",
"codeChallenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
"codeChallengeMethod": "S256"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
clientId: 'app_abc123...',
redirectUri: 'https://example.com/oauth/callback',
scopes: ['read:user', 'read:organization'],
state: 'random_state_abc123',
codeChallenge: 'E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM',
codeChallengeMethod: 'S256'
})
};
fetch('https://api.example.com/oauth/authorize/approve', 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.example.com/oauth/authorize/approve",
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([
'clientId' => 'app_abc123...',
'redirectUri' => 'https://example.com/oauth/callback',
'scopes' => [
'read:user',
'read:organization'
],
'state' => 'random_state_abc123',
'codeChallenge' => 'E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM',
'codeChallengeMethod' => 'S256'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.example.com/oauth/authorize/approve"
payload := strings.NewReader("{\n \"clientId\": \"app_abc123...\",\n \"redirectUri\": \"https://example.com/oauth/callback\",\n \"scopes\": [\n \"read:user\",\n \"read:organization\"\n ],\n \"state\": \"random_state_abc123\",\n \"codeChallenge\": \"E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM\",\n \"codeChallengeMethod\": \"S256\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.example.com/oauth/authorize/approve")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"clientId\": \"app_abc123...\",\n \"redirectUri\": \"https://example.com/oauth/callback\",\n \"scopes\": [\n \"read:user\",\n \"read:organization\"\n ],\n \"state\": \"random_state_abc123\",\n \"codeChallenge\": \"E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM\",\n \"codeChallengeMethod\": \"S256\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/oauth/authorize/approve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"clientId\": \"app_abc123...\",\n \"redirectUri\": \"https://example.com/oauth/callback\",\n \"scopes\": [\n \"read:user\",\n \"read:organization\"\n ],\n \"state\": \"random_state_abc123\",\n \"codeChallenge\": \"E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM\",\n \"codeChallengeMethod\": \"S256\"\n}"
response = http.request(request)
puts response.read_bodyoauth
Approve authorization and generate code
⚠️ SECURITY: User approves OAuth authorization request. Generates an authorization code for the client application. Rate limit: 20 requests per minute.
POST
/
oauth
/
authorize
/
approve
Approve authorization and generate code
curl --request POST \
--url https://api.example.com/oauth/authorize/approve \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"clientId": "app_abc123...",
"redirectUri": "https://example.com/oauth/callback",
"scopes": [
"read:user",
"read:organization"
],
"state": "random_state_abc123",
"codeChallenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
"codeChallengeMethod": "S256"
}
'import requests
url = "https://api.example.com/oauth/authorize/approve"
payload = {
"clientId": "app_abc123...",
"redirectUri": "https://example.com/oauth/callback",
"scopes": ["read:user", "read:organization"],
"state": "random_state_abc123",
"codeChallenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
"codeChallengeMethod": "S256"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
clientId: 'app_abc123...',
redirectUri: 'https://example.com/oauth/callback',
scopes: ['read:user', 'read:organization'],
state: 'random_state_abc123',
codeChallenge: 'E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM',
codeChallengeMethod: 'S256'
})
};
fetch('https://api.example.com/oauth/authorize/approve', 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.example.com/oauth/authorize/approve",
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([
'clientId' => 'app_abc123...',
'redirectUri' => 'https://example.com/oauth/callback',
'scopes' => [
'read:user',
'read:organization'
],
'state' => 'random_state_abc123',
'codeChallenge' => 'E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM',
'codeChallengeMethod' => 'S256'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.example.com/oauth/authorize/approve"
payload := strings.NewReader("{\n \"clientId\": \"app_abc123...\",\n \"redirectUri\": \"https://example.com/oauth/callback\",\n \"scopes\": [\n \"read:user\",\n \"read:organization\"\n ],\n \"state\": \"random_state_abc123\",\n \"codeChallenge\": \"E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM\",\n \"codeChallengeMethod\": \"S256\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.example.com/oauth/authorize/approve")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"clientId\": \"app_abc123...\",\n \"redirectUri\": \"https://example.com/oauth/callback\",\n \"scopes\": [\n \"read:user\",\n \"read:organization\"\n ],\n \"state\": \"random_state_abc123\",\n \"codeChallenge\": \"E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM\",\n \"codeChallengeMethod\": \"S256\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/oauth/authorize/approve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"clientId\": \"app_abc123...\",\n \"redirectUri\": \"https://example.com/oauth/callback\",\n \"scopes\": [\n \"read:user\",\n \"read:organization\"\n ],\n \"state\": \"random_state_abc123\",\n \"codeChallenge\": \"E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM\",\n \"codeChallengeMethod\": \"S256\"\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
OAuth application client ID
Example:
"app_abc123..."
Redirect URI registered with the application
Example:
"https://example.com/oauth/callback"
Approved OAuth scopes
Example:
["read:user", "read:organization"]
CSRF protection state parameter
Example:
"random_state_abc123"
PKCE code challenge (optional, from authorization request)
Example:
"E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM"
PKCE code challenge method (optional, from authorization request)
Available options:
S256, plain Example:
"S256"
Response
Authorization approved. Returns authorization code, state, and redirect_uri for client redirect.