Using a credentials array

Hello,
I am not seeing the way of using an array as credentials for a node. I am trying to create a node with a list of pairs user/password, with variable length, that must be stored in the credentials file.
But I am not able to generate the code to manage that array as credentials.
I can design correctly a variable length list in the html code (I have based the code on the dropdown node of the dashboard), but have not been able to adapt the code to use credentials. I have tried many different options, all of them failing.
I think it is not possible, as NR imposes that credentials must be defined specifying the type of the text: text or password, for example:

        credentials: {
            user: {type:"text"},
            password: {type:"password"}
        }

I have tried. as the best candidate:

        credentials: [{
            user: {type:"text"},
            password: {type:"password"}
        }]

with no success. I haven't found any literature about it. Does anyboy know if it is possible?
Thanks a lot in advance

Hi @peret2000

good question - not something that has ever come up before.

Looking through the code I can see a few places where it might not work as expected if you made the value a non-string type such as an array. So it is not currently possible. We would have to make a number of changes to support a new type of credential such as array. Even then, we'd have to think about how the individual values in that array would be handled as we have to treat password type values differently to the others whether they appear in an array or not.

1 Like

Thanks, @knolleary,
I understand it is a difficult issue, and it has not interested to anybody but me :smile:
It was more as a practice to learn node creation than a real need, but indeed it is something I came up with, after using the same 'secret' keys for many nodes that did not use credentials, or, for example, when using rest api's, where it is necessary to use a user or token in the get request.

For such cases, it is handy to have a 'store' with credentials based on key/value pairs than can be selected with the key, and added to an object that will then become part of the request.

Thanks for your anwser!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.