@startanaicompany/cli 1.4.7 → 1.4.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.
- package/package.json +1 -1
- package/src/lib/oauth.js +12 -5
package/package.json
CHANGED
package/src/lib/oauth.js
CHANGED
|
@@ -90,8 +90,8 @@ async function pollForCompletion(sessionId, apiKey) {
|
|
|
90
90
|
|
|
91
91
|
const baseUrl = getApiUrl().replace('/api/v1', ''); // Remove /api/v1 suffix
|
|
92
92
|
|
|
93
|
-
// Give user time to complete OAuth flow in browser (
|
|
94
|
-
await sleep(
|
|
93
|
+
// Give user time to complete OAuth flow in browser (60 seconds)
|
|
94
|
+
await sleep(60000);
|
|
95
95
|
|
|
96
96
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
97
97
|
await sleep(pollInterval);
|
|
@@ -119,14 +119,21 @@ async function pollForCompletion(sessionId, apiKey) {
|
|
|
119
119
|
// Still pending, continue polling
|
|
120
120
|
// Silent polling - spinner shows progress
|
|
121
121
|
} catch (error) {
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
// During polling, 401/404 errors are expected while user completes OAuth in browser
|
|
123
|
+
// Only fail on other error types or after timeout
|
|
124
|
+
const status = error.response?.status;
|
|
125
|
+
|
|
126
|
+
if (status === 401 || status === 404) {
|
|
127
|
+
// Session not found yet or not authorized yet - continue polling
|
|
128
|
+
continue;
|
|
124
129
|
}
|
|
130
|
+
|
|
131
|
+
// For other errors (500, network errors, etc.), throw immediately
|
|
125
132
|
throw error;
|
|
126
133
|
}
|
|
127
134
|
}
|
|
128
135
|
|
|
129
|
-
throw new Error('OAuth authorization timed out (5 minutes). Please try again.');
|
|
136
|
+
throw new Error('OAuth authorization timed out (5 minutes). Please complete the authorization in your browser and try again.');
|
|
130
137
|
}
|
|
131
138
|
|
|
132
139
|
/**
|