n8n-nodes-jygse-vw-weconnect 0.2.14 → 0.2.16

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.
@@ -40,6 +40,8 @@ exports.VwWeConnect = void 0;
40
40
  const n8n_workflow_1 = require("n8n-workflow");
41
41
  const crypto = __importStar(require("crypto"));
42
42
  const axios_1 = __importDefault(require("axios"));
43
+ const axios_cookiejar_support_1 = require("axios-cookiejar-support");
44
+ const tough_cookie_1 = require("tough-cookie");
43
45
  class VwWeConnect {
44
46
  constructor() {
45
47
  this.description = {
@@ -179,15 +181,15 @@ class VwWeConnect {
179
181
  }
180
182
  }
181
183
  exports.VwWeConnect = VwWeConnect;
182
- // VW OAuth2 Configuration (Updated January 2026 - "go" type for We Connect App from ioBroker.vw-connect)
183
- // Note: This is for We Connect / We Connect Go (T6.1 California, etc.)
184
+ // VW OAuth2 Configuration (Updated January 2026 - "go" type for We Connect Go from ioBroker.vw-connect)
185
+ // Note: This is for We Connect Go (T6.1 California, etc.)
184
186
  const VW_CLIENT_ID = 'ac42b0fa-3b11-48a0-a941-43a399e7ef84@apps_vw-dilab_com';
185
- const VW_SCOPE = 'openid profile mbb email cars birthdate badge address vin';
187
+ const VW_SCOPE = 'openid profile address email phone';
186
188
  const VW_REDIRECT_URI = 'vwconnect://de.volkswagen.vwconnect/oauth2redirect/identitykit';
187
189
  const VW_RESPONSE_TYPE = 'id_token token code';
188
- // WeConnect App headers (from ioBroker.vw-connect v0.7.15)
189
- const VW_USER_AGENT = 'Mozilla/5.0 (Linux; Android 14; SM-G960F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36';
190
- const VW_APP_PACKAGE = 'com.volkswagen.weconnect';
190
+ // We Connect Go headers (from ioBroker.vw-connect - "go" type)
191
+ const VW_USER_AGENT = 'okhttp/3.9.1';
192
+ const VW_APP_PACKAGE = ''; // Empty for "go" type
191
193
  const VW_ACCEPT_LANGUAGE = 'en-US,en;q=0.9';
192
194
  function generateTraceId() {
193
195
  // Generate UUID v4 format
@@ -220,15 +222,20 @@ async function vwLogin(context, email, password) {
220
222
  const state = generateTraceId(); // Use UUID as state
221
223
  const traceId = generateTraceId(); // For weconnect-trace-id header
222
224
  const codeVerifier = generateCodeVerifier();
223
- // Browser-like headers (EXACTLY from ioBroker.vw-connect)
225
+ // Create cookie jar for session management (like ioBroker)
226
+ const jar = new tough_cookie_1.CookieJar();
227
+ const client = (0, axios_cookiejar_support_1.wrapper)(axios_1.default.create({ jar }));
228
+ // Headers from ioBroker.vw-connect "go" type
224
229
  const browserHeaders = {
225
230
  'User-Agent': VW_USER_AGENT,
226
231
  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
227
232
  'Accept-Language': VW_ACCEPT_LANGUAGE,
228
233
  'Accept-Encoding': 'gzip, deflate',
229
- 'x-requested-with': VW_APP_PACKAGE,
230
- 'upgrade-insecure-requests': '1',
231
234
  };
235
+ // Only add x-requested-with if VW_APP_PACKAGE is set
236
+ if (VW_APP_PACKAGE) {
237
+ browserHeaders['x-requested-with'] = VW_APP_PACKAGE;
238
+ }
232
239
  // Generate PKCE code challenge
233
240
  const codeChallenge = generateCodeChallenge(codeVerifier);
234
241
  // Step 1: Go directly to identity.vwgroup.io (like ioBroker adapter)
@@ -242,9 +249,8 @@ async function vwLogin(context, email, password) {
242
249
  '&state=' + state +
243
250
  '&code_challenge=' + codeChallenge +
244
251
  '&code_challenge_method=S256';
245
- // Use axios directly to have full control over redirect handling
246
- // n8n's httpRequest helper has issues with custom scheme redirects
247
- const authorizeResponse = await axios_1.default.get(authorizeUrl, {
252
+ // Use axios with cookie jar for session management
253
+ const authorizeResponse = await client.get(authorizeUrl, {
248
254
  headers: browserHeaders,
249
255
  maxRedirects: 0, // Don't follow any redirects
250
256
  validateStatus: () => true, // Accept any status code
@@ -302,9 +308,9 @@ async function vwLogin(context, email, password) {
302
308
  if (!currentUrl.startsWith('http') && !currentUrl.startsWith('/')) {
303
309
  break;
304
310
  }
305
- // Follow the redirect using axios
311
+ // Follow the redirect using axios with cookie jar
306
312
  const followUrl = currentUrl.startsWith('http') ? currentUrl : `https://identity.vwgroup.io${currentUrl}`;
307
- const followResponse = await axios_1.default.get(followUrl, {
313
+ const followResponse = await client.get(followUrl, {
308
314
  headers: browserHeaders,
309
315
  maxRedirects: 0,
310
316
  validateStatus: () => true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-jygse-vw-weconnect",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "description": "n8n community node for VW We Connect - Control your Volkswagen T6.1 and other VW vehicles",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",
@@ -44,10 +44,13 @@
44
44
  ]
45
45
  },
46
46
  "dependencies": {
47
- "axios": "^1.6.0"
47
+ "axios": "^1.6.0",
48
+ "axios-cookiejar-support": "^5.0.0",
49
+ "tough-cookie": "^4.1.0"
48
50
  },
49
51
  "devDependencies": {
50
52
  "@types/node": "^20.10.0",
53
+ "@types/tough-cookie": "^4.0.5",
51
54
  "@typescript-eslint/parser": "^6.0.0",
52
55
  "eslint": "^8.56.0",
53
56
  "gulp": "^4.0.2",