Store credentials from backend code


I'm trying to store a refresh token of the Microsoft Graph API as a credential. I can store the tenant id and client id from the html page (Node-RED is taking care of that), but the refresh token is generated by backend code (my-config-node.js file). In the documentation I see this paragraph under Advanced credential use and I analyzed the twitter node source, but as far as I can tell the Twitter node does not actually save a credential from the backend javascript.

Whilst the credential system outlined above is sufficient for most cases, in some circumstances it is necessary to store more values in credentials than just those that get provided by the user. For example, for a node to support an OAuth workflow, it must retain server-assigned tokens that the user never sees. The Twitter node provides a good example of how this can be achieved.

I've tried to just assign the value to this.credentials.refreshToken but that value is lost after Node-RED is stopped.

Can you help me out with my use case?

Thank you,

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