@startanaicompany/cli 1.4.9 → 1.4.10

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/lib/oauth.js +18 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startanaicompany/cli",
3
- "version": "1.4.9",
3
+ "version": "1.4.10",
4
4
  "description": "Official CLI for StartAnAiCompany.com - Deploy AI recruitment sites with ease",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/lib/oauth.js CHANGED
@@ -145,13 +145,14 @@ async function pollForCompletion(sessionId, apiKey) {
145
145
  */
146
146
  async function getConnection(gitHost, apiKey) {
147
147
  try {
148
+ // Use correct header based on token type
149
+ const headers = apiKey.startsWith('st_')
150
+ ? { 'X-Session-Token': apiKey }
151
+ : { 'X-API-Key': apiKey };
152
+
148
153
  const response = await axios.get(
149
154
  `${getApiUrl()}/users/me/oauth`,
150
- {
151
- headers: {
152
- 'X-API-Key': apiKey,
153
- },
154
- }
155
+ { headers }
155
156
  );
156
157
 
157
158
  const connection = response.data.connections.find(
@@ -170,13 +171,14 @@ async function getConnection(gitHost, apiKey) {
170
171
  * @returns {Promise<array>} - Array of connection objects
171
172
  */
172
173
  async function listConnections(apiKey) {
174
+ // Use correct header based on token type
175
+ const headers = apiKey.startsWith('st_')
176
+ ? { 'X-Session-Token': apiKey }
177
+ : { 'X-API-Key': apiKey };
178
+
173
179
  const response = await axios.get(
174
180
  `${getApiUrl()}/users/me/oauth`,
175
- {
176
- headers: {
177
- 'X-API-Key': apiKey,
178
- },
179
- }
181
+ { headers }
180
182
  );
181
183
 
182
184
  return response.data.connections || [];
@@ -188,13 +190,14 @@ async function listConnections(apiKey) {
188
190
  * @param {string} apiKey - User's API key
189
191
  */
190
192
  async function revokeConnection(gitHost, apiKey) {
193
+ // Use correct header based on token type
194
+ const headers = apiKey.startsWith('st_')
195
+ ? { 'X-Session-Token': apiKey }
196
+ : { 'X-API-Key': apiKey };
197
+
191
198
  await axios.delete(
192
199
  `${getApiUrl()}/users/me/oauth/${encodeURIComponent(gitHost)}`,
193
- {
194
- headers: {
195
- 'X-API-Key': apiKey,
196
- },
197
- }
200
+ { headers }
198
201
  );
199
202
  }
200
203