curl --request POST \
--url https://api.ravion.com/oauth/token \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"code": "<string>",
"code_verifier": "<string>",
"device_code": "<string>",
"redirect_uri": "<string>"
}
}
'import requests
url = "https://api.ravion.com/oauth/token"
payload = { "data": {
"code": "<string>",
"code_verifier": "<string>",
"device_code": "<string>",
"redirect_uri": "<string>"
} }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
code: '<string>',
code_verifier: '<string>',
device_code: '<string>',
redirect_uri: '<string>'
}
})
};
fetch('https://api.ravion.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.ravion.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 => json_encode([
'data' => [
'code' => '<string>',
'code_verifier' => '<string>',
'device_code' => '<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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ravion.com/oauth/token"
payload := strings.NewReader("{\n \"data\": {\n \"code\": \"<string>\",\n \"code_verifier\": \"<string>\",\n \"device_code\": \"<string>\",\n \"redirect_uri\": \"<string>\"\n }\n}")
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))
}HttpResponse<String> response = Unirest.post("https://api.ravion.com/oauth/token")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"code\": \"<string>\",\n \"code_verifier\": \"<string>\",\n \"device_code\": \"<string>\",\n \"redirect_uri\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ravion.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/json'
request.body = "{\n \"data\": {\n \"code\": \"<string>\",\n \"code_verifier\": \"<string>\",\n \"device_code\": \"<string>\",\n \"redirect_uri\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"access_token": "<string>",
"expires_in": 123,
"refresh_token": "<string>",
"token_type": "Bearer"
}
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}OAuth 2.1 PKCE token exchange
Exchanges a single-use authorization code (plus the PKCE verifier) for an access+refresh token pair. Called by the CLI after catching the loopback redirect from /oauth/authorize.
curl --request POST \
--url https://api.ravion.com/oauth/token \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"code": "<string>",
"code_verifier": "<string>",
"device_code": "<string>",
"redirect_uri": "<string>"
}
}
'import requests
url = "https://api.ravion.com/oauth/token"
payload = { "data": {
"code": "<string>",
"code_verifier": "<string>",
"device_code": "<string>",
"redirect_uri": "<string>"
} }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
code: '<string>',
code_verifier: '<string>',
device_code: '<string>',
redirect_uri: '<string>'
}
})
};
fetch('https://api.ravion.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.ravion.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 => json_encode([
'data' => [
'code' => '<string>',
'code_verifier' => '<string>',
'device_code' => '<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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ravion.com/oauth/token"
payload := strings.NewReader("{\n \"data\": {\n \"code\": \"<string>\",\n \"code_verifier\": \"<string>\",\n \"device_code\": \"<string>\",\n \"redirect_uri\": \"<string>\"\n }\n}")
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))
}HttpResponse<String> response = Unirest.post("https://api.ravion.com/oauth/token")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"code\": \"<string>\",\n \"code_verifier\": \"<string>\",\n \"device_code\": \"<string>\",\n \"redirect_uri\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ravion.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/json'
request.body = "{\n \"data\": {\n \"code\": \"<string>\",\n \"code_verifier\": \"<string>\",\n \"device_code\": \"<string>\",\n \"redirect_uri\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"access_token": "<string>",
"expires_in": 123,
"refresh_token": "<string>",
"token_type": "Bearer"
}
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"action": {
"label": "<string>",
"url": "<string>"
},
"description": "<string>",
"details": [
{
"render": "<string>",
"title": "<string>",
"items": [
"<string>"
],
"object": {}
}
],
"isInternal": true,
"metadata": {},
"requestId": "<string>"
}Body
Token request body. Two grants share this endpoint: the loopback authorization-code grant (CLI exchanges a one-shot code + PKCE verifier) and the RFC 8628 device grant (CLI polls with the device_code from /oauth/device/code). Unauthenticated — security comes from the code/device_code being single-use, short-lived, and (for authorization_code) bound to the SHA-256 of code_verifier. Per-grant required fields are enforced server-side.
Show child attributes
Show child attributes
Response
The request has succeeded.
Token response. The CLI persists access_token + refresh_token; the server only stores their hashes.
Show child attributes
Show child attributes
Was this page helpful?