Hi friends - I’m running into a very strange issue with authorizing an account using Bubble’s API in a custom event.
I am able to post to the 3rd party I’m using to retrieve the user’s “code” which gets displayed on the callback URI in my Bubble app. When I use the api initializer and copy/paste this code, I get a valid response every time, so I know it works.
However, when I trigger a workflow on this page using “if code exists in the URL”, “get code from URL” and trigger the API request as a custom event, I am not receiving a valid response.
I added a step to the custom event that will display the response in a text group on my page and I noticed something very odd: After authorizing on the 3rd party and watching the callback happen in real-time I am seeing the valid response output correctly for a split second and then it changes back to the error above. It’s like the event fires once, succeeds, and the fires again for no reason?
Even stranger still - when I disable the workflow, manually start the authorization process, come back to the callback uri (with the code in the URL), then I re-enable the workflow from the backend, and go back and refresh the front end page ----> it works fine! The request is successful and there’s not a duplicate request. I am able to store the access token as required.
Why would this workflow work correctly when I manually refresh the page but not when the app is loaded in a callback?