curl --request POST \
--url https://{subdomain}.outseta.com/api/v1/tokens/two-factor \
--header 'Content-Type: application/json' \
--data '
{
"challenge_token": "eyJ...",
"code": "123456"
}
'import requests
url = "https://{subdomain}.outseta.com/api/v1/tokens/two-factor"
payload = {
"challenge_token": "eyJ...",
"code": "123456"
}
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({challenge_token: 'eyJ...', code: '123456'})
};
fetch('https://{subdomain}.outseta.com/api/v1/tokens/two-factor', 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://{subdomain}.outseta.com/api/v1/tokens/two-factor",
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([
'challenge_token' => 'eyJ...',
'code' => '123456'
]),
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://{subdomain}.outseta.com/api/v1/tokens/two-factor"
payload := strings.NewReader("{\n \"challenge_token\": \"eyJ...\",\n \"code\": \"123456\"\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://{subdomain}.outseta.com/api/v1/tokens/two-factor")
.header("Content-Type", "application/json")
.body("{\n \"challenge_token\": \"eyJ...\",\n \"code\": \"123456\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.outseta.com/api/v1/tokens/two-factor")
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 \"challenge_token\": \"eyJ...\",\n \"code\": \"123456\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "string",
"authentication_callback_url": "string",
"expires_in": 0,
"id_token": "string",
"refresh_token": "string",
"token_type": "string"
}"string""string"Complete login when user has two-factor authentication enabled.
Call this after POST /api/v1/tokens returns two_factor_required.
Post the challenge token from that response together with the user’s
one-time code (the emailed code, or the current code from their
authenticator app):
{ "challenge_token": "eyJ...", "code": "123456" }
On success the response is 200 with the final access token, in the
same shape as POST /api/v1/tokens:
{ "access_token": "eyJ...", "refresh_token": "...", "token_type": "Bearer", "expires_in": 31536000 }
An incorrect code returns 400 (invalid_grant). A code has at most
five attempts before the challenge locks. An expired challenge returns
410 (challenge_expired) — restart at POST /api/v1/tokens. The
endpoint is rate limited to 10 requests per minute (429).
curl --request POST \
--url https://{subdomain}.outseta.com/api/v1/tokens/two-factor \
--header 'Content-Type: application/json' \
--data '
{
"challenge_token": "eyJ...",
"code": "123456"
}
'import requests
url = "https://{subdomain}.outseta.com/api/v1/tokens/two-factor"
payload = {
"challenge_token": "eyJ...",
"code": "123456"
}
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({challenge_token: 'eyJ...', code: '123456'})
};
fetch('https://{subdomain}.outseta.com/api/v1/tokens/two-factor', 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://{subdomain}.outseta.com/api/v1/tokens/two-factor",
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([
'challenge_token' => 'eyJ...',
'code' => '123456'
]),
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://{subdomain}.outseta.com/api/v1/tokens/two-factor"
payload := strings.NewReader("{\n \"challenge_token\": \"eyJ...\",\n \"code\": \"123456\"\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://{subdomain}.outseta.com/api/v1/tokens/two-factor")
.header("Content-Type", "application/json")
.body("{\n \"challenge_token\": \"eyJ...\",\n \"code\": \"123456\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.outseta.com/api/v1/tokens/two-factor")
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 \"challenge_token\": \"eyJ...\",\n \"code\": \"123456\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "string",
"authentication_callback_url": "string",
"expires_in": 0,
"id_token": "string",
"refresh_token": "string",
"token_type": "string"
}"string""string"Body
The challenge token from the login response and the user's one-time code.
Request body for POST /api/v1/tokens/two-factor: the challenge token from the login response plus the user's one-time code. Property names are snake_case to match the wire format of the token endpoints.
The action binds the body as a loose JObject at runtime; this type exists so the API docs describe the body instead of an opaque data parameter (see [OpenApiRequestBody] on the action).
The challenge_token returned by POST /api/v1/tokens when two-factor authentication is required. Echo it back verbatim.
The user's one-time code: the emailed code for an Email challenge, or the current code from their authenticator app for a Totp challenge.