Sharing information between auth callback and nodered node

#1

Sorry for cross-posting :confused: I hope this is the right session

I’ve this need: I’m using passport + openid-connect to enable access to the nodered. Everything works smooth and i’ve been able also to wrote a callback in settings.js that is called whenever the user is authorized to procede. In this callback, i’d like to “store” somewhere some data (coming from the auth callback) and share this data with the nodered nodes.

I’ve been trying to use context/global variables, but seems that this function are not available in the settings.js passport auth callback .

I’ve tryied also (as suggested somewhere in internet) to add, before the export, in the settings.js
var RED = require.main.require(‘node-red’);
and later on in my callback try to set RED.settings.something=
but seems that the variable is not writable/not syncronized in real time inside nodered node
(i’ve tryied to read in the nodered node RED.settings.something and it say undefined)

Do you have any other suggestions or can you point me out a way to share some information between this passport auth callback with a nodered node?

Thanks a lot,
best regards!
Angelo

0 Likes