Custom Authentication And Replacing Application Tokens

Yes, I get this. I had success in implementing the same too. Now I want to use the same token for my front end to use in my custom nodes to authenticate to another API which will return the JSON payload for the drop-down I had built in the custom node. If I pass the token I can pretty much access the same using

localStorage.getItem("auth-tokens"))["access_token"]

How can I do the same when I pass the User Name and Password? I mean when I pass the User Name and Password and authenticate to the API which returns me the token, how can reuse the same token instead of a node-red created token. Here is the flow diagram to simplify the ask -