I have an API to which I connect for different flows:
- I check orders once per minute.
- I approve orders when users approves them
- I reject orders when user approves them
- I update them or request for updates on different occasions.
- I upload files via this endpoint.
What is the best way to store the bearer token in such a flow? As it may be triggered by multiple actions and also automatically. It exists in many different calls.
Should I every time get a new one for every call? Or I should rather Keep it somewhere and update it once it’s expired. With a separate token refresh flow.
Don’t know what is the proper way to handle this, as before I had tokens I refresh rarer (ex monthly/yearly) or had it build within a whole flow that 1 token = 1 flow.
I know saving in the DB may be a bad idea so what should I do prefereably?
As my idea is a base where everything is hidden and only the backend workflow bypasses the privacy rules.