Validate credential (Internal/Gateway)
curl --request GET \
--url http://localhost:9002/api/v1/auth/validate \
--header 'Authorization: Bearer <token>'import requests
url = "http://localhost:9002/api/v1/auth/validate"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:9002/api/v1/auth/validate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "9002",
CURLOPT_URL => "http://localhost:9002/api/v1/auth/validate",
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 := "http://localhost:9002/api/v1/auth/validate"
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("http://localhost:9002/api/v1/auth/validate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:9002/api/v1/auth/validate")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"user_id": "user-abc123-v1",
"account_id": "acct-xyz789-v1",
"scopes": [
"read",
"write"
],
"auth_type": "jwt",
"is_verified": true
}
}{
"success": false,
"error": {
"code": "AUTH_001",
"type": "validation",
"message": "Authorization token is required"
}
}{
"success": false,
"error": {
"code": "AUTH_002",
"type": "unauthorized",
"message": "Invalid or expired authentication token"
}
}{
"success": false,
"error": {
"code": "AUTH_008",
"type": "forbidden",
"message": "Email verification required for this action"
}
}Authentication
Validate credential
Port: 9002 (private) - Internal use only, not exposed publicly.
Polymorphic credential validation supporting both JWT tokens and API keys. Called by API gateway to validate incoming requests before proxying.
For JWT tokens, validates against Auth0 and returns user information. For API keys, validates the key hash and returns associated user/account info.
When validating for write operations (POST, PUT, PATCH, DELETE), unverified users will receive a 403 Forbidden response.
GET
/
api
/
v1
/
auth
/
validate
Validate credential (Internal/Gateway)
curl --request GET \
--url http://localhost:9002/api/v1/auth/validate \
--header 'Authorization: Bearer <token>'import requests
url = "http://localhost:9002/api/v1/auth/validate"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:9002/api/v1/auth/validate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "9002",
CURLOPT_URL => "http://localhost:9002/api/v1/auth/validate",
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 := "http://localhost:9002/api/v1/auth/validate"
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("http://localhost:9002/api/v1/auth/validate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:9002/api/v1/auth/validate")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"user_id": "user-abc123-v1",
"account_id": "acct-xyz789-v1",
"scopes": [
"read",
"write"
],
"auth_type": "jwt",
"is_verified": true
}
}{
"success": false,
"error": {
"code": "AUTH_001",
"type": "validation",
"message": "Authorization token is required"
}
}{
"success": false,
"error": {
"code": "AUTH_002",
"type": "unauthorized",
"message": "Invalid or expired authentication token"
}
}{
"success": false,
"error": {
"code": "AUTH_008",
"type": "forbidden",
"message": "Email verification required for this action"
}
}Authorizations
bearerAuthapiKeyAuth
JWT token from Auth0
Headers
Original HTTP method from upstream request (used by gateway). If method is POST/PUT/PATCH/DELETE and user is unverified, request is rejected.
Available options:
GET, POST, PUT, PATCH, DELETE 