Exchange a handoff code for the session
curl --request POST \
--url https://testnet.edel-api.xyz/v1/auth/app-handoff/exchange \
--header 'Content-Type: application/json' \
--data '
{
"code": "hO2a7vC4mXq9TzR1sLk8NwB3uYd6Ef5GjPi0QeWn-_A",
"codeVerifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
"redirectUri": "https://markets.edel.finance/app/auth/callback/markets"
}
'import requests
url = "https://testnet.edel-api.xyz/v1/auth/app-handoff/exchange"
payload = {
"code": "hO2a7vC4mXq9TzR1sLk8NwB3uYd6Ef5GjPi0QeWn-_A",
"codeVerifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
"redirectUri": "https://markets.edel.finance/app/auth/callback/markets"
}
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({
code: 'hO2a7vC4mXq9TzR1sLk8NwB3uYd6Ef5GjPi0QeWn-_A',
codeVerifier: 'dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk',
redirectUri: 'https://markets.edel.finance/app/auth/callback/markets'
})
};
fetch('https://testnet.edel-api.xyz/v1/auth/app-handoff/exchange', 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://testnet.edel-api.xyz/v1/auth/app-handoff/exchange",
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([
'code' => 'hO2a7vC4mXq9TzR1sLk8NwB3uYd6Ef5GjPi0QeWn-_A',
'codeVerifier' => 'dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk',
'redirectUri' => 'https://markets.edel.finance/app/auth/callback/markets'
]),
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://testnet.edel-api.xyz/v1/auth/app-handoff/exchange"
payload := strings.NewReader("{\n \"code\": \"hO2a7vC4mXq9TzR1sLk8NwB3uYd6Ef5GjPi0QeWn-_A\",\n \"codeVerifier\": \"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk\",\n \"redirectUri\": \"https://markets.edel.finance/app/auth/callback/markets\"\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://testnet.edel-api.xyz/v1/auth/app-handoff/exchange")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"hO2a7vC4mXq9TzR1sLk8NwB3uYd6Ef5GjPi0QeWn-_A\",\n \"codeVerifier\": \"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk\",\n \"redirectUri\": \"https://markets.edel.finance/app/auth/callback/markets\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://testnet.edel-api.xyz/v1/auth/app-handoff/exchange")
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 \"code\": \"hO2a7vC4mXq9TzR1sLk8NwB3uYd6Ef5GjPi0QeWn-_A\",\n \"codeVerifier\": \"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk\",\n \"redirectUri\": \"https://markets.edel.finance/app/auth/callback/markets\"\n}"
response = http.request(request)
puts response.read_body{
"version": "external-auth-login/v1",
"token": "<redacted>",
"walletState": "wallet_ready"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "request-id",
"code": "unauthorized",
"safeMessage": "A verified end-user session is required.",
"retryable": false,
"recoveryActions": [
"do_not_retry"
],
"occurredAtEpochMs": 0
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "request-id",
"code": "service_degraded",
"safeMessage": "Authentication dependencies are temporarily unavailable.",
"retryable": true,
"recoveryActions": [
"observe_status",
"retry_after"
],
"occurredAtEpochMs": 0
}Auth
Exchange a handoff code for the session
Called by the native app with the one-time code from its callback, the PKCE verifier of the challenge it sent and the same callback URL. Returns the same end-user session the web page holds, with the same lifetime and revocation. An unknown, used, expired or mismatched code answers one 401, and any attempt uses the code up. The response is never cacheable.
Method and path: POST /v1/auth/app-handoff/exchange
Authentication: none.
Request schema: ExternalAuthAppHandoffExchangeRequest.
Response schema: ExternalAuthLoginCompleteResponse.
Error envelope: ExternalRestError (external-rest-error/v1).
POST
/
v1
/
auth
/
app-handoff
/
exchange
Exchange a handoff code for the session
curl --request POST \
--url https://testnet.edel-api.xyz/v1/auth/app-handoff/exchange \
--header 'Content-Type: application/json' \
--data '
{
"code": "hO2a7vC4mXq9TzR1sLk8NwB3uYd6Ef5GjPi0QeWn-_A",
"codeVerifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
"redirectUri": "https://markets.edel.finance/app/auth/callback/markets"
}
'import requests
url = "https://testnet.edel-api.xyz/v1/auth/app-handoff/exchange"
payload = {
"code": "hO2a7vC4mXq9TzR1sLk8NwB3uYd6Ef5GjPi0QeWn-_A",
"codeVerifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
"redirectUri": "https://markets.edel.finance/app/auth/callback/markets"
}
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({
code: 'hO2a7vC4mXq9TzR1sLk8NwB3uYd6Ef5GjPi0QeWn-_A',
codeVerifier: 'dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk',
redirectUri: 'https://markets.edel.finance/app/auth/callback/markets'
})
};
fetch('https://testnet.edel-api.xyz/v1/auth/app-handoff/exchange', 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://testnet.edel-api.xyz/v1/auth/app-handoff/exchange",
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([
'code' => 'hO2a7vC4mXq9TzR1sLk8NwB3uYd6Ef5GjPi0QeWn-_A',
'codeVerifier' => 'dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk',
'redirectUri' => 'https://markets.edel.finance/app/auth/callback/markets'
]),
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://testnet.edel-api.xyz/v1/auth/app-handoff/exchange"
payload := strings.NewReader("{\n \"code\": \"hO2a7vC4mXq9TzR1sLk8NwB3uYd6Ef5GjPi0QeWn-_A\",\n \"codeVerifier\": \"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk\",\n \"redirectUri\": \"https://markets.edel.finance/app/auth/callback/markets\"\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://testnet.edel-api.xyz/v1/auth/app-handoff/exchange")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"hO2a7vC4mXq9TzR1sLk8NwB3uYd6Ef5GjPi0QeWn-_A\",\n \"codeVerifier\": \"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk\",\n \"redirectUri\": \"https://markets.edel.finance/app/auth/callback/markets\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://testnet.edel-api.xyz/v1/auth/app-handoff/exchange")
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 \"code\": \"hO2a7vC4mXq9TzR1sLk8NwB3uYd6Ef5GjPi0QeWn-_A\",\n \"codeVerifier\": \"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk\",\n \"redirectUri\": \"https://markets.edel.finance/app/auth/callback/markets\"\n}"
response = http.request(request)
puts response.read_body{
"version": "external-auth-login/v1",
"token": "<redacted>",
"walletState": "wallet_ready"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "request-id",
"code": "unauthorized",
"safeMessage": "A verified end-user session is required.",
"retryable": false,
"recoveryActions": [
"do_not_retry"
],
"occurredAtEpochMs": 0
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"agentRefusal": "agents_not_admitted_in_environment",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "request-id",
"code": "service_degraded",
"safeMessage": "Authentication dependencies are temporarily unavailable.",
"retryable": true,
"recoveryActions": [
"observe_status",
"retry_after"
],
"occurredAtEpochMs": 0
}Body
application/json