curl --request POST \
--url https://api.netzfabrik.com/auth/login \
--header 'Content-Type: application/json' \
--data '
{
"email": "max.mustermann@example.com",
"password": "S1cheres-Passw0rt"
}
'import requests
url = "https://api.netzfabrik.com/auth/login"
payload = {
"email": "max.mustermann@example.com",
"password": "S1cheres-Passw0rt"
}
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({email: 'max.mustermann@example.com', password: 'S1cheres-Passw0rt'})
};
fetch('https://api.netzfabrik.com/auth/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://api.netzfabrik.com/auth/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([
'email' => 'max.mustermann@example.com',
'password' => 'S1cheres-Passw0rt'
]),
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 := "https://api.netzfabrik.com/auth/login"
payload := strings.NewReader("{\n \"email\": \"max.mustermann@example.com\",\n \"password\": \"S1cheres-Passw0rt\"\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("https://api.netzfabrik.com/auth/login")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"max.mustermann@example.com\",\n \"password\": \"S1cheres-Passw0rt\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.netzfabrik.com/auth/login")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"max.mustermann@example.com\",\n \"password\": \"S1cheres-Passw0rt\"\n}"
response = http.request(request)
puts response.read_body{
"token": "<string>"
}Anmelden (JWT ausstellen)
Meldet einen Benutzer mit E-Mail-Adresse und Passwort an. Ohne zweiten Faktor enthält die Antwort ein Token-Paar:
token: Access-Token (JWT), bei jeder Anfrage alsAuthorization: Bearer <token>senden. Es ist zeitlich begrenzt gültig.refresh_token: damit holtPOST /auth/token/refreshein neues Token-Paar.
Zweiter Faktor. Ist für das Konto TOTP oder ein Passkey aktiv, enthält die Antwort statt des Token-Paars mfaRequired: true, ein kurzlebiges preAuthToken (Gültigkeit in Sekunden in expiresIn) und die möglichen Verfahren in methods. Bestätige den Faktor mit POST /auth/2fa/verify und dem preAuthToken als Bearer-Token. Schreibt eine Richtlinie einen zweiten Faktor vor, der noch nicht eingerichtet ist, kommt mfaEnrollmentRequired: true; mit dem preAuthToken sind dann nur die Einrichtungs-Endpunkte erreichbar.
Nach fünf Fehlversuchen innerhalb von 15 Minuten (je E-Mail-Adresse und IP) antwortet der Endpunkt mit 429 Too Many Requests. Für Skripte und Server-Integrationen empfehlen wir statt Passwort-Login einen API-Token (X-API-TOKEN).
curl --request POST \
--url https://api.netzfabrik.com/auth/login \
--header 'Content-Type: application/json' \
--data '
{
"email": "max.mustermann@example.com",
"password": "S1cheres-Passw0rt"
}
'import requests
url = "https://api.netzfabrik.com/auth/login"
payload = {
"email": "max.mustermann@example.com",
"password": "S1cheres-Passw0rt"
}
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({email: 'max.mustermann@example.com', password: 'S1cheres-Passw0rt'})
};
fetch('https://api.netzfabrik.com/auth/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://api.netzfabrik.com/auth/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([
'email' => 'max.mustermann@example.com',
'password' => 'S1cheres-Passw0rt'
]),
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 := "https://api.netzfabrik.com/auth/login"
payload := strings.NewReader("{\n \"email\": \"max.mustermann@example.com\",\n \"password\": \"S1cheres-Passw0rt\"\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("https://api.netzfabrik.com/auth/login")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"max.mustermann@example.com\",\n \"password\": \"S1cheres-Passw0rt\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.netzfabrik.com/auth/login")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"max.mustermann@example.com\",\n \"password\": \"S1cheres-Passw0rt\"\n}"
response = http.request(request)
puts response.read_body{
"token": "<string>"
}Was this page helpful?