Resend challenge
curl --request POST \
--url https://{defaultHost}/v1/auth/{app_id}/challenges/{token}/resendimport requests
url = "https://{defaultHost}/v1/auth/{app_id}/challenges/{token}/resend"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://{defaultHost}/v1/auth/{app_id}/challenges/{token}/resend', 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://{defaultHost}/v1/auth/{app_id}/challenges/{token}/resend",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{defaultHost}/v1/auth/{app_id}/challenges/{token}/resend"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{defaultHost}/v1/auth/{app_id}/challenges/{token}/resend")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/auth/{app_id}/challenges/{token}/resend")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"challenge": {
"token": "ch_abc123xyz789",
"expires_at": "2023-11-07T05:31:56Z",
"remaining_attempts": 3,
"time_remaining": 540,
"intent": "<string>",
"delivery_required": true
}
}{
"error": "This challenge type cannot be resent",
"error_code": "cannot_resend"
}Challenges
Resend challenge
Resend a challenge delivery (OTP code or magic link). This cancels the current challenge and creates a new one with a fresh code.
Only applicable to delivery-based methods: email_otp, sms_otp, magic_link
POST
/
v1
/
auth
/
{app_id}
/
challenges
/
{token}
/
resend
Resend challenge
curl --request POST \
--url https://{defaultHost}/v1/auth/{app_id}/challenges/{token}/resendimport requests
url = "https://{defaultHost}/v1/auth/{app_id}/challenges/{token}/resend"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://{defaultHost}/v1/auth/{app_id}/challenges/{token}/resend', 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://{defaultHost}/v1/auth/{app_id}/challenges/{token}/resend",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{defaultHost}/v1/auth/{app_id}/challenges/{token}/resend"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{defaultHost}/v1/auth/{app_id}/challenges/{token}/resend")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/auth/{app_id}/challenges/{token}/resend")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"challenge": {
"token": "ch_abc123xyz789",
"expires_at": "2023-11-07T05:31:56Z",
"remaining_attempts": 3,
"time_remaining": 540,
"intent": "<string>",
"delivery_required": true
}
}{
"error": "This challenge type cannot be resent",
"error_code": "cannot_resend"
}Was this page helpful?
⌘I