Check API authentication
curl --request GET \
--url https://api.ornn.com/v1/auth/session \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ornn.com/v1/auth/session"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ornn.com/v1/auth/session', 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.ornn.com/v1/auth/session",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.ornn.com/v1/auth/session"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.ornn.com/v1/auth/session")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ornn.com/v1/auth/session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"user_id": "55555555-5555-4555-8555-555555555555",
"email": "developer@example.com",
"name": "Example Developer",
"role": "user",
"organizations": [
{
"id": "22222222-2222-4222-8222-222222222222",
"name": "Example organization",
"approved": true,
"role": "consumer"
}
],
"impersonating": false
}{
"code": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"detail": "<string>"
}Check API authentication
Returns the account and organizations visible to the credential. An API key sees exactly its own organization and has no staff privileges.
GET
/
v1
/
auth
/
session
Check API authentication
curl --request GET \
--url https://api.ornn.com/v1/auth/session \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ornn.com/v1/auth/session"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ornn.com/v1/auth/session', 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.ornn.com/v1/auth/session",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.ornn.com/v1/auth/session"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.ornn.com/v1/auth/session")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ornn.com/v1/auth/session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"user_id": "55555555-5555-4555-8555-555555555555",
"email": "developer@example.com",
"name": "Example Developer",
"role": "user",
"organizations": [
{
"id": "22222222-2222-4222-8222-222222222222",
"name": "Example organization",
"approved": true,
"role": "consumer"
}
],
"impersonating": false
}{
"code": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"detail": "<string>"
}Call this first with a new key. The single entry in
organizations is the organization the key acts in. Use its id for organization routes such as List organization SSH keys, and check approved before calling operations that require an approved organization.
This is the only account read an API key can make. Profile, member, preference, and notification routes are console-only and return 403 with api_key_requires_session.
CLI equivalent: ornn context.Authorizations
Create an organization API key in Account Settings > Developer. Do not send this key to the Kubernetes API server.
Was this page helpful?