Java (SDK)
package hello.world;
import java.lang.Exception;
import org.openapis.openapi.AriesJava;
import org.openapis.openapi.models.errors.ErrorResponse;
import org.openapis.openapi.models.operations.Oauth2TokenAuthorizeMFARequest;
import org.openapis.openapi.models.operations.Oauth2TokenAuthorizeMFAResponse;
public class Application {
public static void main(String[] args) throws ErrorResponse, Exception {
AriesJava sdk = AriesJava.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
Oauth2TokenAuthorizeMFARequest req = Oauth2TokenAuthorizeMFARequest.builder()
.nextStepAuthId("auth_mfa_123abc")
.verificationCode("123456")
.build();
Oauth2TokenAuthorizeMFAResponse res = sdk.oAuth2().authorizeMFA()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}curl --request POST \
--url https://api.tradearies.dev/v1/oauth2/authorize/mfa \
--header 'Content-Type: application/json' \
--data '
{
"next_step_auth_id": "auth_mfa_123abc",
"verification_code": "123456"
}
'import requests
url = "https://api.tradearies.dev/v1/oauth2/authorize/mfa"
payload = {
"next_step_auth_id": "auth_mfa_123abc",
"verification_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({next_step_auth_id: 'auth_mfa_123abc', verification_code: '123456'})
};
fetch('https://api.tradearies.dev/v1/oauth2/authorize/mfa', 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.tradearies.dev/v1/oauth2/authorize/mfa",
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([
'next_step_auth_id' => 'auth_mfa_123abc',
'verification_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://api.tradearies.dev/v1/oauth2/authorize/mfa"
payload := strings.NewReader("{\n \"next_step_auth_id\": \"auth_mfa_123abc\",\n \"verification_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))
}require 'uri'
require 'net/http'
url = URI("https://api.tradearies.dev/v1/oauth2/authorize/mfa")
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 \"next_step_auth_id\": \"auth_mfa_123abc\",\n \"verification_code\": \"123456\"\n}"
response = http.request(request)
puts response.read_body{
"next_step_auth_id": "auth_confirm_456def",
"consent_required": true,
"client_name": "My Application",
"scopes": [
"read",
"write"
]
}OAuth2
OAuth2 Authorize MFA
Verifies MFA code during OAuth2 authorization flow. This endpoint is called after oauth2_Authorize when MFA is required. The user provides the verification code that was sent to their registered phone number along with the next_step_auth_id received from the previous authorization step.
POST
/
v1
/
oauth2
/
authorize
/
mfa
Java (SDK)
package hello.world;
import java.lang.Exception;
import org.openapis.openapi.AriesJava;
import org.openapis.openapi.models.errors.ErrorResponse;
import org.openapis.openapi.models.operations.Oauth2TokenAuthorizeMFARequest;
import org.openapis.openapi.models.operations.Oauth2TokenAuthorizeMFAResponse;
public class Application {
public static void main(String[] args) throws ErrorResponse, Exception {
AriesJava sdk = AriesJava.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
Oauth2TokenAuthorizeMFARequest req = Oauth2TokenAuthorizeMFARequest.builder()
.nextStepAuthId("auth_mfa_123abc")
.verificationCode("123456")
.build();
Oauth2TokenAuthorizeMFAResponse res = sdk.oAuth2().authorizeMFA()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}curl --request POST \
--url https://api.tradearies.dev/v1/oauth2/authorize/mfa \
--header 'Content-Type: application/json' \
--data '
{
"next_step_auth_id": "auth_mfa_123abc",
"verification_code": "123456"
}
'import requests
url = "https://api.tradearies.dev/v1/oauth2/authorize/mfa"
payload = {
"next_step_auth_id": "auth_mfa_123abc",
"verification_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({next_step_auth_id: 'auth_mfa_123abc', verification_code: '123456'})
};
fetch('https://api.tradearies.dev/v1/oauth2/authorize/mfa', 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.tradearies.dev/v1/oauth2/authorize/mfa",
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([
'next_step_auth_id' => 'auth_mfa_123abc',
'verification_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://api.tradearies.dev/v1/oauth2/authorize/mfa"
payload := strings.NewReader("{\n \"next_step_auth_id\": \"auth_mfa_123abc\",\n \"verification_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))
}require 'uri'
require 'net/http'
url = URI("https://api.tradearies.dev/v1/oauth2/authorize/mfa")
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 \"next_step_auth_id\": \"auth_mfa_123abc\",\n \"verification_code\": \"123456\"\n}"
response = http.request(request)
puts response.read_body{
"next_step_auth_id": "auth_confirm_456def",
"consent_required": true,
"client_name": "My Application",
"scopes": [
"read",
"write"
]
}Body
application/json
Was this page helpful?
⌘I