Storing the token for regular calls

I have an API to which I connect for different flows:

  1. I check orders once per minute.
  2. I approve orders when users approves them
  3. I reject orders when user approves them
  4. I update them or request for updates on different occasions.
  5. 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.

Put that onto the User data type, make it private and run your calls via backend workflows with ‘ignore privacy rules’ checked.

1 Like