multicloud_rule_manager 1.1.64 → 1.1.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,32 +7,29 @@ export default {
7
7
  describe: "Recupera struttura prodotto e genera Excel",
8
8
  handler: async (argv) => {
9
9
  try {
10
- console.log("🔹 Retrieve in corso..");
11
-
10
+ console.log("🔹 Retrieve in corso..");
11
+ console.log("🔹 Recupero credenziali per alias:", argv.alias);
12
12
  const cred = getAlias(argv.alias);
13
13
 
14
- // =========================
15
- // 🔐 TOKEN
16
- // =========================
17
- const loginResp = await fetch(
18
- `https://login-eon-no-prod.bit2win.cloud/auth/realms/${cred.realm}/protocol/openid-connect/token`,
19
- {
20
- method: "POST",
21
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
22
- body: new URLSearchParams({
23
- client_id: cred.clientId,
24
- client_secret: cred.clientSecret,
25
- username: cred.username,
26
- password: cred.password,
27
- grant_type: "password"
28
- })
29
- }
30
- );
31
-
32
- const { access_token } = await loginResp.json();
14
+ // --- PRIMA CHIAMATA: token ---
15
+ console.log("🔹 Inizio richiesta token...");
16
+ const loginResp = await fetch(`https://login-eon-no-prod.bit2win.cloud/auth/realms/${cred.realm}/protocol/openid-connect/token`, {
17
+ method: "POST",
18
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
19
+ body: new URLSearchParams({
20
+ client_id: cred.clientId,
21
+ client_secret: cred.clientSecret,
22
+ username: cred.username,
23
+ password: cred.password,
24
+ grant_type: "password"
25
+ })
26
+ });
27
+
28
+ const loginData = await loginResp.json(); // leggi direttamente JSON
29
+ const access_token = loginData.access_token;
33
30
 
34
31
  if (!access_token) {
35
- throw new Error("Token non ricevuto");
32
+ throw new Error("Token non ricevuto nel campo 'access_token'");
36
33
  }
37
34
 
38
35
  const headers = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multicloud_rule_manager",
3
- "version": "1.1.64",
3
+ "version": "1.1.65",
4
4
  "description": "CLI interna per retrieve/upload con token",
5
5
  "main": "index.js",
6
6
  "type": "module",