52 lines
1.1 KiB
YAML
52 lines
1.1 KiB
YAML
info:
|
|
name: Login
|
|
type: http
|
|
seq: 2
|
|
|
|
http:
|
|
method: POST
|
|
url: "{{baseurl}}/v1/auth/login"
|
|
body:
|
|
type: json
|
|
data: |-
|
|
{
|
|
"username": "{{username}}",
|
|
"password": "{{password}}",
|
|
"brandID": "{{brandId}}"
|
|
}
|
|
auth: inherit
|
|
|
|
runtime:
|
|
scripts:
|
|
- type: after-response
|
|
code: |-
|
|
const data = res.getBody();
|
|
|
|
if (data.staus != 200) {
|
|
console.error("Error de login: ", data)
|
|
return 1;
|
|
}
|
|
|
|
if (data && data.accessToken) {
|
|
|
|
bru.setEnvVar("alai_token", data.accessToken);
|
|
|
|
if (data.tokenType) {
|
|
bru.setEnvVar("alai_token_type", data.tokenType);
|
|
}
|
|
|
|
console.log("Token guardado correctamente");
|
|
} else {
|
|
console.error("No se pudo encontrar el accessToken en la respuesta");
|
|
}
|
|
|
|
settings:
|
|
encodeUrl: true
|
|
timeout: 0
|
|
followRedirects: true
|
|
maxRedirects: 5
|
|
|
|
docs: |-
|
|
Necesita un certificado p12 (PFX) y la contraseña asociada para efectuar la operacion.
|
|
Collection Settings => ClientCertificates => Add Certificate
|