Start a sidecar login
curl --request POST \
--url https://use.hoop.dev/api/sidecars/login \
--header 'Content-Type: application/json' \
--header 'hoop-sidecar-token: <hoop-sidecar-token>' \
--data '
{
"name": "payments-sidecar"
}
'import requests
url = "https://use.hoop.dev/api/sidecars/login"
payload = { "name": "payments-sidecar" }
headers = {
"hoop-sidecar-token": "<hoop-sidecar-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'hoop-sidecar-token': '<hoop-sidecar-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({name: 'payments-sidecar'})
};
fetch('https://use.hoop.dev/api/sidecars/login', 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://use.hoop.dev/api/sidecars/login",
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([
'name' => 'payments-sidecar'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"hoop-sidecar-token: <hoop-sidecar-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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://use.hoop.dev/api/sidecars/login"
payload := strings.NewReader("{\n \"name\": \"payments-sidecar\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("hoop-sidecar-token", "<hoop-sidecar-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://use.hoop.dev/api/sidecars/login")
.header("hoop-sidecar-token", "<hoop-sidecar-token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"payments-sidecar\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://use.hoop.dev/api/sidecars/login")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["hoop-sidecar-token"] = '<hoop-sidecar-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"payments-sidecar\"\n}"
response = http.request(request)
puts response.read_body{
"expires_in": 600,
"interval": 5,
"user_code": "BCDF-GHJK",
"verification_url": "https://use.hoop.dev/sidecars/login?code=BCDF-GHJK"
}{
"message": "the error description"
}{
"message": "the error description"
}{
"message": "the error description"
}{
"message": "the error description"
}{
"message": "the error description"
}{
"message": "the error description"
}Sidecars
Start a sidecar login
Starts a device-code login. Send the token the sidecar made for itself in the hoop-sidecar-token header; only its hash is stored. Show the user code and the verification URL, then poll /sidecars/login/poll.
POST
/
sidecars
/
login
Start a sidecar login
curl --request POST \
--url https://use.hoop.dev/api/sidecars/login \
--header 'Content-Type: application/json' \
--header 'hoop-sidecar-token: <hoop-sidecar-token>' \
--data '
{
"name": "payments-sidecar"
}
'import requests
url = "https://use.hoop.dev/api/sidecars/login"
payload = { "name": "payments-sidecar" }
headers = {
"hoop-sidecar-token": "<hoop-sidecar-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'hoop-sidecar-token': '<hoop-sidecar-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({name: 'payments-sidecar'})
};
fetch('https://use.hoop.dev/api/sidecars/login', 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://use.hoop.dev/api/sidecars/login",
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([
'name' => 'payments-sidecar'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"hoop-sidecar-token: <hoop-sidecar-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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://use.hoop.dev/api/sidecars/login"
payload := strings.NewReader("{\n \"name\": \"payments-sidecar\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("hoop-sidecar-token", "<hoop-sidecar-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://use.hoop.dev/api/sidecars/login")
.header("hoop-sidecar-token", "<hoop-sidecar-token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"payments-sidecar\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://use.hoop.dev/api/sidecars/login")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["hoop-sidecar-token"] = '<hoop-sidecar-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"payments-sidecar\"\n}"
response = http.request(request)
puts response.read_body{
"expires_in": 600,
"interval": 5,
"user_code": "BCDF-GHJK",
"verification_url": "https://use.hoop.dev/sidecars/login?code=BCDF-GHJK"
}{
"message": "the error description"
}{
"message": "the error description"
}{
"message": "the error description"
}{
"message": "the error description"
}{
"message": "the error description"
}{
"message": "the error description"
}Headers
A token the sidecar made for itself: hsc_ and at least 32 random bytes
Body
application/json
The request body resource
The name the sidecar asks for. The approving admin may change it.
Example:
"payments-sidecar"
Response
Created
Seconds until the code expires
Example:
600
Seconds the sidecar waits between polls
Example:
5
The code the person confirms in the web app
Example:
"BCDF-GHJK"
The page that approves this code
Example:
"https://use.hoop.dev/sidecars/login?code=BCDF-GHJK"
Was this page helpful?