n8n-nodes-jygse-vw-weconnect 0.1.12 → 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.
|
@@ -179,8 +179,23 @@ async function vwLogin(context, email, password) {
|
|
|
179
179
|
try {
|
|
180
180
|
const traceId = generateTraceId();
|
|
181
181
|
const nonce = generateNonce();
|
|
182
|
-
//
|
|
183
|
-
|
|
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 = {
|
|
184
199
|
'User-Agent': VW_USER_AGENT,
|
|
185
200
|
'Accept': '*/*',
|
|
186
201
|
'Accept-Language': VW_ACCEPT_LANGUAGE,
|
|
@@ -199,10 +214,11 @@ async function vwLogin(context, email, password) {
|
|
|
199
214
|
redirect_uri: VW_REDIRECT_URI,
|
|
200
215
|
nonce: nonce,
|
|
201
216
|
});
|
|
217
|
+
// Use browser-like headers for the initial CARIAD BFF request
|
|
202
218
|
const authorizeResponse = await context.helpers.httpRequest({
|
|
203
219
|
method: 'GET',
|
|
204
220
|
url: `${authorizeUrl}?${authorizeParams.toString()}`,
|
|
205
|
-
headers:
|
|
221
|
+
headers: browserHeaders,
|
|
206
222
|
encoding: 'text',
|
|
207
223
|
returnFullResponse: true,
|
|
208
224
|
ignoreHttpStatusErrors: true,
|
|
@@ -250,12 +266,12 @@ async function vwLogin(context, email, password) {
|
|
|
250
266
|
if (currentUrl.includes('/u/login') && stateToken) {
|
|
251
267
|
break;
|
|
252
268
|
}
|
|
253
|
-
// Follow the redirect
|
|
269
|
+
// Follow the redirect using browser-like headers
|
|
254
270
|
const followUrl = currentUrl.startsWith('http') ? currentUrl : `https://identity.vwgroup.io${currentUrl}`;
|
|
255
271
|
const followResponse = await context.helpers.httpRequest({
|
|
256
272
|
method: 'GET',
|
|
257
273
|
url: followUrl,
|
|
258
|
-
headers:
|
|
274
|
+
headers: browserHeaders,
|
|
259
275
|
encoding: 'text',
|
|
260
276
|
returnFullResponse: true,
|
|
261
277
|
ignoreHttpStatusErrors: true,
|
|
@@ -458,7 +474,9 @@ async function vwLogin(context, email, password) {
|
|
|
458
474
|
method: 'POST',
|
|
459
475
|
url: `https://identity.vwgroup.io/u/login?state=${encodeURIComponent(stateToken)}`,
|
|
460
476
|
headers: {
|
|
461
|
-
|
|
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',
|
|
462
480
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
463
481
|
'Origin': 'https://identity.vwgroup.io',
|
|
464
482
|
'Referer': `https://identity.vwgroup.io/u/login?state=${encodeURIComponent(stateToken)}`,
|
|
@@ -536,7 +554,7 @@ async function vwLogin(context, email, password) {
|
|
|
536
554
|
const followResponse = await context.helpers.httpRequest({
|
|
537
555
|
method: 'GET',
|
|
538
556
|
url: redirectUrl.startsWith('http') ? redirectUrl : `https://identity.vwgroup.io${redirectUrl}`,
|
|
539
|
-
headers:
|
|
557
|
+
headers: browserHeaders,
|
|
540
558
|
encoding: 'text',
|
|
541
559
|
returnFullResponse: true,
|
|
542
560
|
ignoreHttpStatusErrors: true,
|
package/package.json
CHANGED