I've gotten a good user flow established with a custom API integration so far, but I'm running into issues where it seems when too many people submit the form at once, the token doesn't have enough time to get returned to be used by the next request and ends up being blank and causing authentication errors. Then I have to manually refresh it.
This is a terrible UX though and is causing loss of leads. I have created somewhat of a workaround by logging the user data and then using a cron job that does a bulk add/update into the list. However, I still need to check if the email is already in the list because when they're added they receive a promo code that gets inserted as a custom field. As it is now, the same person could keep submitting the form and get multiple codes because it will just update the custom field with the new code.
My concern is that I'll just run into the same issue with the token breaking when multiple people submit the form because it's having to use the token and refresh it for every form submission. I can't use the same workaround since the user needs to immediately be given a message telling them if the email exists already.
Is there some solution to this? As far as I know I have to refresh the token for every single request and that will be problematic if multiple people submit the form within milliseconds of each other.