n8n-nodes-jygse-vw-weconnect 0.1.9 → 0.1.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.
@@ -146,6 +146,17 @@ const VW_CLIENT_ID = 'a24fba63-34b3-4d43-b181-942111e6bda8@apps_vw-dilab_com';
146
146
  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
+ // WeConnect App User-Agent and headers (critical for authentication)
150
+ const VW_USER_AGENT = 'Volkswagen/3.60.0-android/14';
151
+ const VW_APP_PACKAGE = 'com.volkswagen.weconnect';
152
+ function generateTraceId() {
153
+ // Generate UUID v4 format
154
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
155
+ const r = Math.random() * 16 | 0;
156
+ const v = c === 'x' ? r : (r & 0x3 | 0x8);
157
+ return v.toString(16);
158
+ });
159
+ }
149
160
  // Generate PKCE code verifier and challenge
150
161
  function generateCodeVerifier() {
151
162
  const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~';
@@ -179,12 +190,15 @@ async function vwLogin(context, email, password) {
179
190
  code_challenge: codeChallenge,
180
191
  code_challenge_method: 'plain',
181
192
  });
193
+ const traceId = generateTraceId();
182
194
  const authorizeResponse = await context.helpers.httpRequest({
183
195
  method: 'GET',
184
196
  url: `${authorizeUrl}?${authorizeParams.toString()}`,
185
197
  headers: {
186
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.120 Mobile Safari/537.36',
198
+ 'User-Agent': VW_USER_AGENT,
187
199
  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
200
+ 'x-android-package-name': VW_APP_PACKAGE,
201
+ 'weconnect-trace-id': traceId,
188
202
  },
189
203
  encoding: 'text',
190
204
  returnFullResponse: true,
@@ -239,7 +253,7 @@ async function vwLogin(context, email, password) {
239
253
  method: 'GET',
240
254
  url: followUrl,
241
255
  headers: {
242
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.120 Mobile Safari/537.36',
256
+ 'User-Agent': VW_USER_AGENT,
243
257
  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
244
258
  },
245
259
  encoding: 'text',
@@ -347,7 +361,7 @@ async function vwLogin(context, email, password) {
347
361
  method: 'POST',
348
362
  url: 'https://identity.vwgroup.io/signin-service/v1/signin/login/identifier',
349
363
  headers: {
350
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.120 Mobile Safari/537.36',
364
+ 'User-Agent': VW_USER_AGENT,
351
365
  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
352
366
  'Content-Type': 'application/x-www-form-urlencoded',
353
367
  },
@@ -383,7 +397,7 @@ async function vwLogin(context, email, password) {
383
397
  method: 'POST',
384
398
  url: 'https://identity.vwgroup.io/signin-service/v1/signin/login/authenticate',
385
399
  headers: {
386
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.120 Mobile Safari/537.36',
400
+ 'User-Agent': VW_USER_AGENT,
387
401
  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
388
402
  'Content-Type': 'application/x-www-form-urlencoded',
389
403
  },
@@ -444,7 +458,7 @@ async function vwLogin(context, email, password) {
444
458
  method: 'POST',
445
459
  url: `https://identity.vwgroup.io/u/login?state=${encodeURIComponent(stateToken)}`,
446
460
  headers: {
447
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.120 Mobile Safari/537.36',
461
+ 'User-Agent': VW_USER_AGENT,
448
462
  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
449
463
  'Content-Type': 'application/x-www-form-urlencoded',
450
464
  'Origin': 'https://identity.vwgroup.io',
@@ -524,7 +538,7 @@ async function vwLogin(context, email, password) {
524
538
  method: 'GET',
525
539
  url: redirectUrl.startsWith('http') ? redirectUrl : `https://identity.vwgroup.io${redirectUrl}`,
526
540
  headers: {
527
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.120 Mobile Safari/537.36',
541
+ 'User-Agent': VW_USER_AGENT,
528
542
  },
529
543
  encoding: 'text',
530
544
  returnFullResponse: true,
@@ -568,7 +582,7 @@ async function vwLogin(context, email, password) {
568
582
  method: 'POST',
569
583
  url: 'https://emea.bff.cariad.digital/user-login/login/v1',
570
584
  headers: {
571
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.120 Mobile Safari/537.36',
585
+ 'User-Agent': VW_USER_AGENT,
572
586
  'Accept': 'application/json',
573
587
  'Content-Type': 'application/json',
574
588
  },
@@ -590,7 +604,7 @@ async function vwLogin(context, email, password) {
590
604
  method: 'POST',
591
605
  url: 'https://tokenrefreshservice.apps.emea.vwapps.io/exchangeAuthCode',
592
606
  headers: {
593
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.120 Mobile Safari/537.36',
607
+ 'User-Agent': VW_USER_AGENT,
594
608
  'Accept': 'application/json',
595
609
  'Content-Type': 'application/json',
596
610
  'X-Client-Id': VW_CLIENT_ID,
@@ -632,7 +646,7 @@ async function getHomeRegion(context, session, vin) {
632
646
  method: 'GET',
633
647
  url: `https://mal-1a.prd.ece.vwg-connect.com/api/cs/vds/v1/vehicles/${vin}/homeRegion`,
634
648
  headers: {
635
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36',
649
+ 'User-Agent': VW_USER_AGENT,
636
650
  'Accept': 'application/json',
637
651
  'Authorization': `Bearer ${session.accessToken}`,
638
652
  },
@@ -655,7 +669,7 @@ async function getPosition(context, session, vin) {
655
669
  method: 'GET',
656
670
  url: `https://emea.bff.cariad.digital/vehicle/v1/vehicles/${vin}/parkingposition`,
657
671
  headers: {
658
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36',
672
+ 'User-Agent': VW_USER_AGENT,
659
673
  'Accept': 'application/json',
660
674
  'Authorization': `Bearer ${session.accessToken}`,
661
675
  },
@@ -675,7 +689,7 @@ async function getPosition(context, session, vin) {
675
689
  method: 'GET',
676
690
  url: `${homeRegion}/api/bs/cf/v1/VW/DE/vehicles/${vin}/position`,
677
691
  headers: {
678
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36',
692
+ 'User-Agent': VW_USER_AGENT,
679
693
  'Accept': 'application/json',
680
694
  'Authorization': `Bearer ${session.accessToken}`,
681
695
  },
@@ -702,7 +716,7 @@ async function getVehicleStatus(context, session, vin) {
702
716
  method: 'GET',
703
717
  url: `https://emea.bff.cariad.digital/vehicle/v1/vehicles/${vin}/selectivestatus?jobs=all`,
704
718
  headers: {
705
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36',
719
+ 'User-Agent': VW_USER_AGENT,
706
720
  'Accept': 'application/json',
707
721
  'Authorization': `Bearer ${session.accessToken}`,
708
722
  },
@@ -722,7 +736,7 @@ async function getVehicleStatus(context, session, vin) {
722
736
  method: 'GET',
723
737
  url: `${homeRegion}/api/bs/vsr/v1/VW/DE/vehicles/${vin}/status`,
724
738
  headers: {
725
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36',
739
+ 'User-Agent': VW_USER_AGENT,
726
740
  'Accept': 'application/json',
727
741
  'Authorization': `Bearer ${session.accessToken}`,
728
742
  },
@@ -749,7 +763,7 @@ async function getHeaterStatus(context, session, vin) {
749
763
  method: 'GET',
750
764
  url: `${homeRegion}/api/bs/climatisation/v1/VW/DE/vehicles/${vin}/climater`,
751
765
  headers: {
752
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36',
766
+ 'User-Agent': VW_USER_AGENT,
753
767
  'Accept': 'application/json',
754
768
  'Authorization': `Bearer ${session.accessToken}`,
755
769
  },
@@ -776,7 +790,7 @@ async function controlHeater(context, session, vin, spin, action, duration) {
776
790
  method: 'GET',
777
791
  url: `${homeRegion}/api/rolesrights/authorization/v2/vehicles/${vin}/services/rclima_v1/operations/P_START_CLIMA_AU/security-pin-auth-requested`,
778
792
  headers: {
779
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36',
793
+ 'User-Agent': VW_USER_AGENT,
780
794
  'Accept': 'application/json',
781
795
  'Authorization': `Bearer ${session.accessToken}`,
782
796
  },
@@ -789,7 +803,7 @@ async function controlHeater(context, session, vin, spin, action, duration) {
789
803
  method: 'POST',
790
804
  url: `${homeRegion}/api/rolesrights/authorization/v2/security-pin-auth-completed`,
791
805
  headers: {
792
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36',
806
+ 'User-Agent': VW_USER_AGENT,
793
807
  'Accept': 'application/json',
794
808
  'Content-Type': 'application/json',
795
809
  'Authorization': `Bearer ${session.accessToken}`,
@@ -820,7 +834,7 @@ async function controlHeater(context, session, vin, spin, action, duration) {
820
834
  };
821
835
  }
822
836
  const headers = {
823
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; SM-G973F) AppleWebKit/537.36',
837
+ 'User-Agent': VW_USER_AGENT,
824
838
  'Accept': 'application/json',
825
839
  'Content-Type': 'application/json',
826
840
  'Authorization': `Bearer ${session.accessToken}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-jygse-vw-weconnect",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
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",