n8n-nodes-jygse-vw-weconnect 0.2.1 → 0.2.3
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.
|
@@ -1,7 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.VwWeConnect = void 0;
|
|
4
37
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
38
|
+
const crypto = __importStar(require("crypto"));
|
|
5
39
|
class VwWeConnect {
|
|
6
40
|
constructor() {
|
|
7
41
|
this.description = {
|
|
@@ -141,11 +175,11 @@ class VwWeConnect {
|
|
|
141
175
|
}
|
|
142
176
|
}
|
|
143
177
|
exports.VwWeConnect = VwWeConnect;
|
|
144
|
-
// VW OAuth2 Configuration (Updated January 2026 - from ioBroker.vw-connect)
|
|
145
|
-
const VW_CLIENT_ID = '
|
|
146
|
-
const VW_SCOPE = 'openid profile
|
|
147
|
-
const VW_REDIRECT_URI = '
|
|
148
|
-
const VW_RESPONSE_TYPE = '
|
|
178
|
+
// VW OAuth2 Configuration (Updated January 2026 - CORRECT values from ioBroker.vw-connect)
|
|
179
|
+
const VW_CLIENT_ID = '9496332b-ea03-4091-a224-8c746b885068@apps_vw-dilab_com';
|
|
180
|
+
const VW_SCOPE = 'openid profile mbb email cars birthdate badge address vin';
|
|
181
|
+
const VW_REDIRECT_URI = 'carnet://identity-kit/login';
|
|
182
|
+
const VW_RESPONSE_TYPE = 'id_token token code';
|
|
149
183
|
// WeConnect App headers (from ioBroker.vw-connect v0.7.15)
|
|
150
184
|
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';
|
|
151
185
|
const VW_APP_PACKAGE = 'com.volkswagen.weconnect';
|
|
@@ -167,11 +201,13 @@ function generateCodeVerifier() {
|
|
|
167
201
|
}
|
|
168
202
|
return result;
|
|
169
203
|
}
|
|
170
|
-
|
|
171
|
-
//
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
204
|
+
function generateCodeChallenge(verifier) {
|
|
205
|
+
// SHA256 hash of the verifier, then base64url encode
|
|
206
|
+
const hash = crypto.createHash('sha256').update(verifier).digest();
|
|
207
|
+
return hash.toString('base64')
|
|
208
|
+
.replace(/\+/g, '-')
|
|
209
|
+
.replace(/\//g, '_')
|
|
210
|
+
.replace(/=/g, '');
|
|
175
211
|
}
|
|
176
212
|
async function vwLogin(context, email, password) {
|
|
177
213
|
try {
|
|
@@ -188,6 +224,8 @@ async function vwLogin(context, email, password) {
|
|
|
188
224
|
'x-requested-with': VW_APP_PACKAGE,
|
|
189
225
|
'upgrade-insecure-requests': '1',
|
|
190
226
|
};
|
|
227
|
+
// Generate PKCE code challenge (required by VW identity)
|
|
228
|
+
const codeChallenge = generateCodeChallenge(codeVerifier);
|
|
191
229
|
// Step 1: Go directly to identity.vwgroup.io (like ioBroker adapter)
|
|
192
230
|
const authorizeUrl = 'https://identity.vwgroup.io/oidc/v1/authorize';
|
|
193
231
|
const authorizeParams = new URLSearchParams({
|
|
@@ -197,6 +235,8 @@ async function vwLogin(context, email, password) {
|
|
|
197
235
|
redirect_uri: VW_REDIRECT_URI,
|
|
198
236
|
nonce: nonce,
|
|
199
237
|
state: state,
|
|
238
|
+
code_challenge: codeChallenge,
|
|
239
|
+
code_challenge_method: 'S256',
|
|
200
240
|
});
|
|
201
241
|
// Use browser-like headers for initial request
|
|
202
242
|
// Let n8n follow redirects automatically to reach the login page
|
package/package.json
CHANGED