Currently I store the values in this.spokes, an array of objects. Ideally I would like to save them as credentials (e.g. JSON String). When I define a credential as type: 'text' and use an accordingly named input field, the value shows up.
I understand valyes of type password are not available in the UI, but I use text here.
However I can't seem to get hold of the value in oneditprepare or oneditsave.
What do I miss?
Clarification (Dec26):
The challenge is onEditPrepare of an existing node. The this.credentials.token object doesn’t carry the values, so when you had 10 tokens, you would need to reenter all 10 token values
I'd probably store the hosts in a regular array (setup in the defaults) and the store the passwords (in the credentials object) using the host name as the key to the value part which would be the password.
this.credentials has the credentials in the js file as expected. In the html file it only has some Boolean flags. But there must be a mechanism since an input element gets populated when it is type text
That’s the part I struggle with details. The “password” (token in my case) are not too sensitive, so if I get to the point where they are not stored in the flow, I’m good.
The challenge: I might have multiple hosts but I only want to change one of the passwords. Something like
It won't work because as we already know, credentials are never passed back - only a placeholder value of _PASSWD_ (or something similar) is ever sent back to the client.
Don't initialise token to and empty object.
Dont update any token that where its value would become the placeholder value.
TIP.
In your existing code, put a debugger statement before the update of token & inspect it in the browsers console to see what the value of curToken is for unaltered passwords. Then alter your code to skip setting that entry if the curToken is that placeholder value.
You want to use text cred type, so the value is real - it is not hidden by __PWRD__
Use the debugger to see the value of this.credentials in oneditprepare
Hmmm. When I set credentials: { test: {type = „text“ }} I get clear text back when linking it to an input field. Only type=password gets the placeholder. I shall take your pointers and debug a little more and report back.