How to access auth_token

I saw this PR is merged Feature add: Store external token when authenticate if provided by ArFe · Pull Request #3460 · node-red/node-red · GitHub.
Now I'm able to authenticate with external api and set the token which api returns in response .

Now How can I access the token?
what I'm trying to achieve to is I have created some custom nodes which takes some fields from the user and under the hood call the api and that api need token, and we have returned at authentication time and stored it, Now I wanted to access the token in custom-node.js file.
@ArFe

Hi sabir,

I wouldn't be able to tell you. I'm not sure it can be done, even more easily.

The token on that PR is for authenticating the interface, or the user to the interface, not anything else.
It makes sure the user has the rights to read/write to the flow via an external entity.

In any case, the user isn't always logged in to make your request succeed with a valid token.
So, what is the problem you're trying to solve that storing a token manually on the http request flow won't fix?

Hii, thanks for the reply,
Currently the way I'm storing the token is: Once we verify the token or in after authenticating what I'm doing is in settings.js global.token = response.data.token and then in custom-node.js file I fetch the token via token.global and pass it to the external api call, which is used by custom node.

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