curl --request POST \
--url https://auth.preprod.alignet.io/token \
--header 'ALG-API-VERSION: <alg-api-version>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "authorize",
"grant_type": "client_credentials",
"audience": "https://api.preprod.alignet.io/",
"client_id": "your_client_id",
"client_secret": "your_client_secret",
"scope": "create:token post:charges get:charges delete:charges"
}
'import requests
url = "https://auth.preprod.alignet.io/token"
payload = {
"action": "authorize",
"grant_type": "client_credentials",
"audience": "https://api.preprod.alignet.io/",
"client_id": "your_client_id",
"client_secret": "your_client_secret",
"scope": "create:token post:charges get:charges delete:charges"
}
headers = {
"ALG-API-VERSION": "<alg-api-version>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'ALG-API-VERSION': '<alg-api-version>', 'Content-Type': 'application/json'},
body: JSON.stringify({
action: 'authorize',
grant_type: 'client_credentials',
audience: 'https://api.preprod.alignet.io/',
client_id: 'your_client_id',
client_secret: 'your_client_secret',
scope: 'create:token post:charges get:charges delete:charges'
})
};
fetch('https://auth.preprod.alignet.io/token', 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://auth.preprod.alignet.io/token",
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([
'action' => 'authorize',
'grant_type' => 'client_credentials',
'audience' => 'https://api.preprod.alignet.io/',
'client_id' => 'your_client_id',
'client_secret' => 'your_client_secret',
'scope' => 'create:token post:charges get:charges delete:charges'
]),
CURLOPT_HTTPHEADER => [
"ALG-API-VERSION: <alg-api-version>",
"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://auth.preprod.alignet.io/token"
payload := strings.NewReader("{\n \"action\": \"authorize\",\n \"grant_type\": \"client_credentials\",\n \"audience\": \"https://api.preprod.alignet.io/\",\n \"client_id\": \"your_client_id\",\n \"client_secret\": \"your_client_secret\",\n \"scope\": \"create:token post:charges get:charges delete:charges\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("ALG-API-VERSION", "<alg-api-version>")
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://auth.preprod.alignet.io/token")
.header("ALG-API-VERSION", "<alg-api-version>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"authorize\",\n \"grant_type\": \"client_credentials\",\n \"audience\": \"https://api.preprod.alignet.io/\",\n \"client_id\": \"your_client_id\",\n \"client_secret\": \"your_client_secret\",\n \"scope\": \"create:token post:charges get:charges delete:charges\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://auth.preprod.alignet.io/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["ALG-API-VERSION"] = '<alg-api-version>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"authorize\",\n \"grant_type\": \"client_credentials\",\n \"audience\": \"https://api.preprod.alignet.io/\",\n \"client_id\": \"your_client_id\",\n \"client_secret\": \"your_client_secret\",\n \"scope\": \"create:token post:charges get:charges delete:charges\"\n}"
response = http.request(request)
puts response.read_body{
"action": "authorize",
"success": true,
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...",
"scope": "create:token api-test:create:token",
"expires_in": 8600,
"token_type": "Bearer",
"authorization": {
"meta": {
"status": {
"code": "00",
"message_ilgn": [
{
"locale": "es_PE",
"value": "Access Token creado"
}
]
}
}
}
}Generar Access Token
Genera un Bearer Token usando credenciales del comercio y el flujo client_credentials.
Si prefieres ver la solicitud documentada paso a paso, revisa Autenticación.
curl --request POST \
--url https://auth.preprod.alignet.io/token \
--header 'ALG-API-VERSION: <alg-api-version>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "authorize",
"grant_type": "client_credentials",
"audience": "https://api.preprod.alignet.io/",
"client_id": "your_client_id",
"client_secret": "your_client_secret",
"scope": "create:token post:charges get:charges delete:charges"
}
'import requests
url = "https://auth.preprod.alignet.io/token"
payload = {
"action": "authorize",
"grant_type": "client_credentials",
"audience": "https://api.preprod.alignet.io/",
"client_id": "your_client_id",
"client_secret": "your_client_secret",
"scope": "create:token post:charges get:charges delete:charges"
}
headers = {
"ALG-API-VERSION": "<alg-api-version>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'ALG-API-VERSION': '<alg-api-version>', 'Content-Type': 'application/json'},
body: JSON.stringify({
action: 'authorize',
grant_type: 'client_credentials',
audience: 'https://api.preprod.alignet.io/',
client_id: 'your_client_id',
client_secret: 'your_client_secret',
scope: 'create:token post:charges get:charges delete:charges'
})
};
fetch('https://auth.preprod.alignet.io/token', 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://auth.preprod.alignet.io/token",
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([
'action' => 'authorize',
'grant_type' => 'client_credentials',
'audience' => 'https://api.preprod.alignet.io/',
'client_id' => 'your_client_id',
'client_secret' => 'your_client_secret',
'scope' => 'create:token post:charges get:charges delete:charges'
]),
CURLOPT_HTTPHEADER => [
"ALG-API-VERSION: <alg-api-version>",
"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://auth.preprod.alignet.io/token"
payload := strings.NewReader("{\n \"action\": \"authorize\",\n \"grant_type\": \"client_credentials\",\n \"audience\": \"https://api.preprod.alignet.io/\",\n \"client_id\": \"your_client_id\",\n \"client_secret\": \"your_client_secret\",\n \"scope\": \"create:token post:charges get:charges delete:charges\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("ALG-API-VERSION", "<alg-api-version>")
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://auth.preprod.alignet.io/token")
.header("ALG-API-VERSION", "<alg-api-version>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"authorize\",\n \"grant_type\": \"client_credentials\",\n \"audience\": \"https://api.preprod.alignet.io/\",\n \"client_id\": \"your_client_id\",\n \"client_secret\": \"your_client_secret\",\n \"scope\": \"create:token post:charges get:charges delete:charges\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://auth.preprod.alignet.io/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["ALG-API-VERSION"] = '<alg-api-version>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"authorize\",\n \"grant_type\": \"client_credentials\",\n \"audience\": \"https://api.preprod.alignet.io/\",\n \"client_id\": \"your_client_id\",\n \"client_secret\": \"your_client_secret\",\n \"scope\": \"create:token post:charges get:charges delete:charges\"\n}"
response = http.request(request)
puts response.read_body{
"action": "authorize",
"success": true,
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...",
"scope": "create:token api-test:create:token",
"expires_in": 8600,
"token_type": "Bearer",
"authorization": {
"meta": {
"status": {
"code": "00",
"message_ilgn": [
{
"locale": "es_PE",
"value": "Access Token creado"
}
]
}
}
}
}Headers
Version del API a usar.
Body
Accion a ejecutar.
"authorize"
Metodo de autorizacion.
"client_credentials"
URL base del API Orquestador segun el ambiente configurado.
https://api.preprod.alignet.io/, https://api.alignet.io/ "https://api.preprod.alignet.io/"
Identificacion del cliente.
"your_client_id"
Secreto del cliente.
"your_client_secret"
Permisos a solicitar, separados por espacios.
"create:token post:charges get:charges delete:charges"
Response
Token generado correctamente.
Accion a ejecutar.
"authorize"
Indica si el proceso se realizo correctamente.
true
Objeto que contiene metadatos del flujo ejecutado.
Show child attributes
Show child attributes
Token para usar en las APIs. Antes de consumir endpoints protegidos, puedes revisar la solicitud del token en Autenticación.
"eyJhbGciOiJIUzI1NiIs..."
Permisos asociados al token generado.
"create:token api-test:create:token"
Tiempo de expiracion del token en segundos.
8600
Tipo de token.
"Bearer"

