My application uses external REST API and the API token (given to each user upon login) is stored in the custom state API_TOKEN, then to be passed to API connector. Under certain conditions (cannot re-create which ones exactly) the following bug occurs:
the value of the token is correctly retrieved and assigned to the custom state (I see it in the debug)
when it is turn to call the API connector method - the bubble debug window shows the correct value of the parameter; but in reality (observing the logs from the API back-end) bubble passes the “default” value for authorization token (as written in the API connector’s method definition), so the method fails
And if I do a silly work-around, by moving the part about API communication into a separate custom workflow, and then doing “schedule custom workflow with delay of 0 seconds” in my main workflow - it starts to work
In running workflows, scheduling backend workflow actions always run first regardless of their position/step. By the looks of it, it seems like the schedule backend workflow action is being triggered first hence it can’t reference to the custom state.
Yes, this is almost always the right way if you need your actions to follow an order.
Also, I suggest you don’t store the value of the token in the frontend as they can easily be accessed
In the original code I did not have any scheduling, just one workflow, which retrieves the token, stores it in the custom state and uses it - and that did not work, unfortunately
Where should I store it then? We have multiple users of the app (on the REST back-end) and there are no corresponding Bubble users to store the data as user’s attributes