n8n-nodes-github-copilot 3.9.0 → 3.10.0

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.
@@ -10,23 +10,24 @@ exports.estimateTokens = estimateTokens;
10
10
  exports.validateTokenLimit = validateTokenLimit;
11
11
  exports.truncateToTokenLimit = truncateToTokenLimit;
12
12
  async function makeApiRequest(context, endpoint, body, hasMedia = false) {
13
+ var _a;
13
14
  const credentials = await context.getCredentials('githubOAuth2Api');
14
- const token = credentials.accessToken;
15
+ console.log('🔍 OAuth2 Credentials Debug:', Object.keys(credentials));
16
+ const token = (credentials.accessToken ||
17
+ credentials.access_token ||
18
+ ((_a = credentials.oauthTokenData) === null || _a === void 0 ? void 0 : _a.access_token) ||
19
+ credentials.token);
15
20
  if (!token) {
16
- throw new Error('GitHub Copilot: No access token found in credentials');
21
+ console.error(' Available credential properties:', Object.keys(credentials));
22
+ console.error('❌ Full credential object:', JSON.stringify(credentials, null, 2));
23
+ throw new Error('GitHub Copilot: No access token found in OAuth2 credentials. Available properties: ' + Object.keys(credentials).join(', '));
17
24
  }
18
- if (!token.startsWith('gho_')) {
19
- const tokenPrefix = token.substring(0, token.indexOf('_') + 1) || token.substring(0, 4);
20
- const tokenSuffix = token.length > 5 ? token.substring(token.length - 5) : token;
21
- console.error(`❌ GitHub Copilot Auth Debug: Invalid token format. Got: ${tokenPrefix}...${tokenSuffix}`);
22
- throw new Error(`GitHub Copilot API requires GitHub Copilot tokens (gho_*). ` +
23
- `Received token with prefix: ${tokenPrefix}...${tokenSuffix}. ` +
24
- `Personal Access Tokens (ghp_*) and other formats are not supported. ` +
25
- `Please obtain a GitHub Copilot access token from your organization.`);
25
+ const tokenPrefix = token.substring(0, Math.min(4, token.indexOf('_') + 1)) || token.substring(0, 4);
26
+ const tokenSuffix = token.substring(Math.max(0, token.length - 5));
27
+ console.log(`🔍 GitHub Copilot OAuth2 Debug: Using token ${tokenPrefix}...${tokenSuffix}`);
28
+ if (!token.startsWith('gho_') && !token.startsWith('ghu_') && !token.startsWith('github_pat_')) {
29
+ console.warn(`⚠️ Unexpected token format: ${tokenPrefix}...${tokenSuffix}. Trying API call anyway.`);
26
30
  }
27
- const tokenPrefix = token.substring(0, token.indexOf('_') + 1);
28
- const tokenSuffix = token.substring(token.length - 5);
29
- console.log(`🔍 GitHub Copilot Auth Debug: Using token ${tokenPrefix}...${tokenSuffix}`);
30
31
  const headers = {
31
32
  'Authorization': `Bearer ${token}`,
32
33
  'Content-Type': 'application/json',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "3.9.0",
3
+ "version": "3.10.0",
4
4
  "description": "n8n community node for GitHub Copilot with CLI integration, Chat API access, and AI Chat Model for workflows - access GPT-5, Claude, Gemini and more using your Copilot subscription",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/sufficit/n8n-nodes-github-copilot",