n8n-nodes-amis-v1 0.1.7 → 0.1.8
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.
|
@@ -196,6 +196,7 @@ class MisaAmisLogin {
|
|
|
196
196
|
}
|
|
197
197
|
let pollingSuccess = false;
|
|
198
198
|
let attempts = 0;
|
|
199
|
+
let lastResponseData = null;
|
|
199
200
|
const maxAttempts = 60; // 2 minutes
|
|
200
201
|
while (!pollingSuccess && attempts < maxAttempts) {
|
|
201
202
|
attempts++;
|
|
@@ -204,6 +205,7 @@ class MisaAmisLogin {
|
|
|
204
205
|
const pollUrl = `https://id.misa.vn/api/login-cross-device/v2/polling?cdRequestId=${cdRequestId}&clientId=${clientId}&deviceId=${clientId}`;
|
|
205
206
|
console.log(`[MISA Debug] Polling Attempt ${attempts}: ${pollUrl}`);
|
|
206
207
|
const pollRes = await client.get(pollUrl, { headers });
|
|
208
|
+
lastResponseData = pollRes.data;
|
|
207
209
|
if (JSON.stringify(pollRes.data).includes("Success") || JSON.stringify(pollRes.data).includes("v1/auth/token")) {
|
|
208
210
|
pollingSuccess = true;
|
|
209
211
|
}
|
|
@@ -232,7 +234,8 @@ class MisaAmisLogin {
|
|
|
232
234
|
});
|
|
233
235
|
}
|
|
234
236
|
else {
|
|
235
|
-
|
|
237
|
+
// Timeout
|
|
238
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Login timeout. Last Polling Status: ${lastResponseData ? JSON.stringify(lastResponseData) : 'No response'}. Please scan QR Code again.`);
|
|
236
239
|
}
|
|
237
240
|
}
|
|
238
241
|
}
|