curl --request POST \
--url http://localhost:9371/registries/{id}/auth \
--header 'Content-Type: application/json' \
--data '
{
"type": "apiKey",
"apiKey": "<string>"
}
'import requests
url = "http://localhost:9371/registries/{id}/auth"
payload = {
"type": "apiKey",
"apiKey": "<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({type: 'apiKey', apiKey: '<string>'})
};
fetch('http://localhost:9371/registries/{id}/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 => "9371",
CURLOPT_URL => "http://localhost:9371/registries/{id}/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([
'type' => 'apiKey',
'apiKey' => '<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 := "http://localhost:9371/registries/{id}/auth"
payload := strings.NewReader("{\n \"type\": \"apiKey\",\n \"apiKey\": \"<string>\"\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:9371/registries/{id}/auth")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"apiKey\",\n \"apiKey\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:9371/registries/{id}/auth")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"apiKey\",\n \"apiKey\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"auth": {
"type": "apiKey",
"status": "configured",
"headerName": "<string>",
"tokenExpiresAt": 123,
"message": "<string>"
}
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "rate_limit_exceeded",
"message": "<string>",
"retryAfter": 1
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Set registry auth
Stores or replaces the credentials used when this server talks to the registry. The method must match the registry’s well-known auth advertisement: a mismatch or an unsupported method fails with 400 and nothing is stored. Credentials are encrypted at rest with AES-256-GCM. For oauth2, a client-credentials token is exchanged immediately; transport policy refusals (non-https token endpoint outside the loopback/insecure-CIDR allowlist) fail with 400, while exchange failures store the credentials and report error status.
curl --request POST \
--url http://localhost:9371/registries/{id}/auth \
--header 'Content-Type: application/json' \
--data '
{
"type": "apiKey",
"apiKey": "<string>"
}
'import requests
url = "http://localhost:9371/registries/{id}/auth"
payload = {
"type": "apiKey",
"apiKey": "<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({type: 'apiKey', apiKey: '<string>'})
};
fetch('http://localhost:9371/registries/{id}/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 => "9371",
CURLOPT_URL => "http://localhost:9371/registries/{id}/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([
'type' => 'apiKey',
'apiKey' => '<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 := "http://localhost:9371/registries/{id}/auth"
payload := strings.NewReader("{\n \"type\": \"apiKey\",\n \"apiKey\": \"<string>\"\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:9371/registries/{id}/auth")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"apiKey\",\n \"apiKey\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:9371/registries/{id}/auth")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"apiKey\",\n \"apiKey\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"auth": {
"type": "apiKey",
"status": "configured",
"headerName": "<string>",
"tokenExpiresAt": 123,
"message": "<string>"
}
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "rate_limit_exceeded",
"message": "<string>",
"retryAfter": 1
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Path Parameters
Registry slug identifying the registry.
1Body
- Option 1
- Option 2
Credentials used when the server talks to the registry. The token endpoint (oauth2) and header name (apiKey) always come from the registry's well-known advertisement, never from this request.
Response
The credentials were stored.
Response body of a registry auth setup request.
Outcome of storing credentials for a registry.
Show child attributes
Show child attributes
Was this page helpful?