n8n-nodes-jygse-vw-weconnect 0.1.11 → 0.1.13

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.
@@ -147,10 +147,11 @@ const VW_SCOPE = 'openid profile badge cars dealers vin';
147
147
  const VW_REDIRECT_URI = 'weconnect://authenticated';
148
148
  const VW_RESPONSE_TYPE = 'code id_token token';
149
149
  // WeConnect App User-Agent and headers (critical for authentication)
150
- // Using exact version from WeConnect-python
150
+ // Using exact version from WeConnect-python v0.60.9
151
151
  const VW_USER_AGENT = 'Volkswagen/3.51.1-android/14';
152
152
  const VW_APP_PACKAGE = 'com.volkswagen.weconnect';
153
153
  const VW_ACCEPT_LANGUAGE = 'de-de';
154
+ const VW_NEWRELIC_ID = 'VgAEWV9QDRAEXFlRAAYPUA==';
154
155
  function generateTraceId() {
155
156
  // Generate UUID v4 format
156
157
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
@@ -178,12 +179,31 @@ async function vwLogin(context, email, password) {
178
179
  try {
179
180
  const traceId = generateTraceId();
180
181
  const nonce = generateNonce();
181
- // Common headers used for all requests (matching WeConnect-python exactly)
182
- const commonHeaders = {
182
+ // Browser-like headers for initial authorization request
183
+ // The CARIAD BFF expects a browser-style request, not an API-style request
184
+ const browserHeaders = {
185
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
186
+ 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8',
187
+ 'Accept-Language': 'de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7',
188
+ 'Accept-Encoding': 'gzip, deflate, br',
189
+ 'Connection': 'keep-alive',
190
+ 'Upgrade-Insecure-Requests': '1',
191
+ 'Sec-Fetch-Dest': 'document',
192
+ 'Sec-Fetch-Mode': 'navigate',
193
+ 'Sec-Fetch-Site': 'none',
194
+ 'Sec-Fetch-User': '?1',
195
+ 'Cache-Control': 'max-age=0',
196
+ };
197
+ // API headers for subsequent requests (WeConnect-python style)
198
+ const apiHeaders = {
183
199
  'User-Agent': VW_USER_AGENT,
184
- 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
200
+ 'Accept': '*/*',
185
201
  'Accept-Language': VW_ACCEPT_LANGUAGE,
202
+ 'Content-Type': 'application/json',
203
+ 'content-version': '1',
186
204
  'Cache-Control': 'no-cache',
205
+ 'Pragma': 'no-cache',
206
+ 'x-newrelic-id': VW_NEWRELIC_ID,
187
207
  'x-android-package-name': VW_APP_PACKAGE,
188
208
  'weconnect-trace-id': traceId,
189
209
  };
@@ -194,10 +214,11 @@ async function vwLogin(context, email, password) {
194
214
  redirect_uri: VW_REDIRECT_URI,
195
215
  nonce: nonce,
196
216
  });
217
+ // Use browser-like headers for the initial CARIAD BFF request
197
218
  const authorizeResponse = await context.helpers.httpRequest({
198
219
  method: 'GET',
199
220
  url: `${authorizeUrl}?${authorizeParams.toString()}`,
200
- headers: commonHeaders,
221
+ headers: browserHeaders,
201
222
  encoding: 'text',
202
223
  returnFullResponse: true,
203
224
  ignoreHttpStatusErrors: true,
@@ -245,12 +266,12 @@ async function vwLogin(context, email, password) {
245
266
  if (currentUrl.includes('/u/login') && stateToken) {
246
267
  break;
247
268
  }
248
- // Follow the redirect
269
+ // Follow the redirect using browser-like headers
249
270
  const followUrl = currentUrl.startsWith('http') ? currentUrl : `https://identity.vwgroup.io${currentUrl}`;
250
271
  const followResponse = await context.helpers.httpRequest({
251
272
  method: 'GET',
252
273
  url: followUrl,
253
- headers: commonHeaders,
274
+ headers: browserHeaders,
254
275
  encoding: 'text',
255
276
  returnFullResponse: true,
256
277
  ignoreHttpStatusErrors: true,
@@ -453,7 +474,9 @@ async function vwLogin(context, email, password) {
453
474
  method: 'POST',
454
475
  url: `https://identity.vwgroup.io/u/login?state=${encodeURIComponent(stateToken)}`,
455
476
  headers: {
456
- ...commonHeaders,
477
+ 'User-Agent': browserHeaders['User-Agent'],
478
+ 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8',
479
+ 'Accept-Language': 'de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7',
457
480
  'Content-Type': 'application/x-www-form-urlencoded',
458
481
  'Origin': 'https://identity.vwgroup.io',
459
482
  'Referer': `https://identity.vwgroup.io/u/login?state=${encodeURIComponent(stateToken)}`,
@@ -531,7 +554,7 @@ async function vwLogin(context, email, password) {
531
554
  const followResponse = await context.helpers.httpRequest({
532
555
  method: 'GET',
533
556
  url: redirectUrl.startsWith('http') ? redirectUrl : `https://identity.vwgroup.io${redirectUrl}`,
534
- headers: commonHeaders,
557
+ headers: browserHeaders,
535
558
  encoding: 'text',
536
559
  returnFullResponse: true,
537
560
  ignoreHttpStatusErrors: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-jygse-vw-weconnect",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
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",