n8n-nodes-jygse-vw-weconnect 0.2.9 → 0.2.11

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.
@@ -175,11 +175,11 @@ class VwWeConnect {
175
175
  }
176
176
  }
177
177
  exports.VwWeConnect = VwWeConnect;
178
- // VW OAuth2 Configuration (Updated January 2026 - "id" type for We Connect App from ioBroker.vw-connect)
179
- // Note: This is for We Connect App (ID.3, ID.4, T6.1 with We Connect 3.x)
180
- const VW_CLIENT_ID = 'a24fba63-34b3-4d43-b181-942111e6bda8@apps_vw-dilab_com';
178
+ // VW OAuth2 Configuration (Updated January 2026 - "go" type for We Connect App from ioBroker.vw-connect)
179
+ // Note: This is for We Connect / We Connect Go (T6.1 California, etc.)
180
+ const VW_CLIENT_ID = 'ac42b0fa-3b11-48a0-a941-43a399e7ef84@apps_vw-dilab_com';
181
181
  const VW_SCOPE = 'openid profile mbb email cars birthdate badge address vin';
182
- const VW_REDIRECT_URI = 'weconnect://authenticated';
182
+ const VW_REDIRECT_URI = 'vwconnect://de.volkswagen.vwconnect/oauth2redirect/identitykit';
183
183
  const VW_RESPONSE_TYPE = 'id_token token code';
184
184
  // WeConnect App headers (from ioBroker.vw-connect v0.7.15)
185
185
  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';
@@ -225,8 +225,9 @@ async function vwLogin(context, email, password) {
225
225
  'x-requested-with': VW_APP_PACKAGE,
226
226
  'upgrade-insecure-requests': '1',
227
227
  };
228
+ // Generate PKCE code challenge
229
+ const codeChallenge = generateCodeChallenge(codeVerifier);
228
230
  // Step 1: Go directly to identity.vwgroup.io (like ioBroker adapter)
229
- // Note: VW ID type does NOT use PKCE (code_challenge)
230
231
  // Build URL manually like ioBroker does (pre-encoded values)
231
232
  const authorizeUrl = 'https://identity.vwgroup.io/oidc/v1/authorize' +
232
233
  '?client_id=' + encodeURIComponent(VW_CLIENT_ID) +
@@ -234,9 +235,11 @@ async function vwLogin(context, email, password) {
234
235
  '&response_type=' + encodeURIComponent(VW_RESPONSE_TYPE) +
235
236
  '&redirect_uri=' + encodeURIComponent(VW_REDIRECT_URI) +
236
237
  '&nonce=' + nonce +
237
- '&state=' + state;
238
+ '&state=' + state +
239
+ '&code_challenge=' + codeChallenge +
240
+ '&code_challenge_method=S256';
238
241
  // Use browser-like headers for initial request
239
- // Let n8n follow redirects automatically to reach the login page
242
+ // Skip auto redirects so we can handle vwconnect:// redirect manually
240
243
  const authorizeResponse = await context.helpers.httpRequest({
241
244
  method: 'GET',
242
245
  url: authorizeUrl,
@@ -244,7 +247,7 @@ async function vwLogin(context, email, password) {
244
247
  encoding: 'text',
245
248
  returnFullResponse: true,
246
249
  ignoreHttpStatusErrors: true,
247
- // Don't skip redirects - let it follow to the login page
250
+ skipAutoFollowRedirects: true,
248
251
  });
249
252
  // Extract response body and check for redirect
250
253
  let htmlContent;
@@ -571,13 +574,15 @@ async function vwLogin(context, email, password) {
571
574
  extractTokens(redirectUrl);
572
575
  }
573
576
  while (maxRedirects > 0 && redirectUrl && !authCode) {
574
- // Check if this is the final redirect to carnet:// scheme
575
- if (redirectUrl.startsWith('carnet://') || redirectUrl.startsWith('weconnect://')) {
577
+ // Check if this is the final redirect to app scheme (carnet://, weconnect://, vwconnect://)
578
+ if (redirectUrl.startsWith('carnet://') || redirectUrl.startsWith('weconnect://') || redirectUrl.startsWith('vwconnect://')) {
576
579
  extractTokens(redirectUrl);
577
580
  break;
578
581
  }
579
- // Skip non-http redirects
582
+ // Skip non-http redirects (other app schemes)
580
583
  if (!redirectUrl.startsWith('http') && !redirectUrl.startsWith('/')) {
584
+ // Try to extract tokens from unknown scheme redirect
585
+ extractTokens(redirectUrl);
581
586
  break;
582
587
  }
583
588
  const followResponse = await context.helpers.httpRequest({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-jygse-vw-weconnect",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
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",