Authenticate
curl --request POST \
--url http://localhost:5252/auth \
--header 'Content-Type: application/json' \
--data '
{
"appName": "MyApp"
}
'import requests
url = "http://localhost:5252/auth"
payload = { "appName": "MyApp" }
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({appName: 'MyApp'})
};
fetch('http://localhost:5252/auth', 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 => "5252",
CURLOPT_URL => "http://localhost:5252/auth",
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([
'appName' => 'MyApp'
]),
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 := "http://localhost:5252/auth"
payload := strings.NewReader("{\n \"appName\": \"MyApp\"\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("http://localhost:5252/auth")
.header("Content-Type", "application/json")
.body("{\n \"appName\": \"MyApp\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:5252/auth")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"appName\": \"MyApp\"\n}"
response = http.request(request)
puts response.read_body{
"token": "295b78d3-a817-4db9-a595-e1643ceb3735"
}{
"error": "Validation Error",
"details": [
{
"prop": "<string>",
"message": "<string>"
}
]
}{
"error": "access not approved"
}{
"error": "Authentication request timed out"
}Server
Authenticate
Generates a unique token for API communication. This endpoint prompts the user to confirm or deny the connection.
POST
/
auth
Authenticate
curl --request POST \
--url http://localhost:5252/auth \
--header 'Content-Type: application/json' \
--data '
{
"appName": "MyApp"
}
'import requests
url = "http://localhost:5252/auth"
payload = { "appName": "MyApp" }
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({appName: 'MyApp'})
};
fetch('http://localhost:5252/auth', 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 => "5252",
CURLOPT_URL => "http://localhost:5252/auth",
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([
'appName' => 'MyApp'
]),
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 := "http://localhost:5252/auth"
payload := strings.NewReader("{\n \"appName\": \"MyApp\"\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("http://localhost:5252/auth")
.header("Content-Type", "application/json")
.body("{\n \"appName\": \"MyApp\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:5252/auth")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"appName\": \"MyApp\"\n}"
response = http.request(request)
puts response.read_body{
"token": "295b78d3-a817-4db9-a595-e1643ceb3735"
}{
"error": "Validation Error",
"details": [
{
"prop": "<string>",
"message": "<string>"
}
]
}{
"error": "access not approved"
}{
"error": "Authentication request timed out"
}Was this page helpful?
⌘I