@5minds/node-red-contrib-processcube 1.5.2-feature-03d546-m361r6u4 → 1.5.2-feature-bdcb95-m362ojnw
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/processcube-engine-config.js +14 -1
package/package.json
CHANGED
@@ -41,8 +41,13 @@ module.exports = function (RED) {
|
|
41
41
|
if (
|
42
42
|
!RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node) ||
|
43
43
|
!RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node)
|
44
|
-
)
|
44
|
+
) {
|
45
45
|
return null;
|
46
|
+
}
|
47
|
+
|
48
|
+
node.log(RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node));
|
49
|
+
node.log(RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node));
|
50
|
+
|
46
51
|
const res = await fetch(url + '/atlas_engine/api/v1/authority', {
|
47
52
|
method: 'GET',
|
48
53
|
headers: {
|
@@ -53,16 +58,22 @@ module.exports = function (RED) {
|
|
53
58
|
|
54
59
|
const issuer = await oidc.Issuer.discover(await res.json());
|
55
60
|
|
61
|
+
node.log('after issuer');
|
62
|
+
|
56
63
|
const client = new issuer.Client({
|
57
64
|
client_id: RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node),
|
58
65
|
client_secret: RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node),
|
59
66
|
});
|
60
67
|
|
68
|
+
node.log('after client');
|
69
|
+
|
61
70
|
const tokenSet = await client.grant({
|
62
71
|
grant_type: 'client_credentials',
|
63
72
|
scope: 'engine_etw engine_read engine_write',
|
64
73
|
});
|
65
74
|
|
75
|
+
node.log('after grant');
|
76
|
+
|
66
77
|
const accessToken = tokenSet.access_token;
|
67
78
|
const decodedToken = jwt.jwtDecode(accessToken);
|
68
79
|
|
@@ -71,6 +82,8 @@ module.exports = function (RED) {
|
|
71
82
|
userId: decodedToken.sub,
|
72
83
|
};
|
73
84
|
|
85
|
+
console.log('luis777', freshIdentity);
|
86
|
+
|
74
87
|
configNode.setIdentity(freshIdentity);
|
75
88
|
|
76
89
|
return freshIdentity;
|