Forum Academy Marketplace Showcase Pricing Features

Element actions after login/signup via API

Hi everyone,

I would like to know how trigger an element action (for example, an animation) after I log a user in or sign a user up via API. For example, I have the following onboarding that creates a new user when the button Sign Up is pressed:

As you can see, the user is created in the database:

But the problem is that, after the user is created, I don’t know how to specify that the current user is the user I have just created and then animate the onboarding out to show another page in the app


You can the workflow trigger “Current user is logged in” and then as your first step you can show the animation.

Hi @shawnmi6, thanks for your reply. I had already tried with the custom event “User is logged in”, but the thing is that all the steps contained within that workflow are executed as soon as I enter the app (even if I don’t write anything in my landing form)

Then you are probably currently logged in. I usually keep track of this by adding a text to my app pages that shows me which user is currently logged in.

If you want to test your app in “logged out mode” you can just add a button with a workflow behind it that logs the user out. When you click this button you are logged out and can test the sign up again.

Thank you Felix,

I have also tried to do that but when I press the log out button (which calls the logout workflow) my app keeps loading for a while (with the loading progress bar on top of the app) but the user is never actually logged out, and eventually an alert appears on the app with a message saying something like “We run a temporary issue…”

I really need to solve this issue!

Can you share a screenshot of the workflow that is triggered when the user clicks on the login button?

Also: do you have a workflow that treats the user on the side differently if it is logged in or not?

The login workflow is as shown below:

I’ve managed to solve the issue about the “temporary bug” that kept my app loading forever but I still don’t get to understand what’s wrong about the login…

When I press the login button I know that the user has logged in because I show a log in the console with the response of the login call:

After logging in, an alert saying “logged in” should appear as per the workflow below:

but for some reason Bubble doesn’t notice that the user has logged in. If after that, I go out of the app and enter again, Bubble notices that the user has logged in and then the alert is shown :S

I’ve noticed that this has something to do with the cookie appname_u1_testmain. When I’m logged out, the value of this cookie is an ID starting with 1609… and when I log in a user via API the cookie stays the same…but then, if I refresh de page, the value of the cookie is set to the ID of the user I have just logged in with and then Bubble realises that the user has logged in :confused: Any thoughts about this?

So after a bit of looking at what happens when logging in via Bubble’s interface I’ve noticed that the issue comes from the fact that the endpoint that is used for logging in via interface or via API is not the same. When someone logs in via Bubble’s interface there is a XML HTTP request to and endpoint called /start, that sets some cookies from the response headers (u1_testmain) and 2 more, and this is (as far as I’m concerned) what allows the browser to know that a user has logged in and perform actions after that.

So this could be solved just by being able to set cookies from the response headers after a request to a custom endpoint has been made… @emmanuel could you tell us if this is possible please? Thanks in advance!

Hi @aculebrasj93 , did you find a solution to this?

I have been struggling with this one myself recently. Until the page is refreshed the page doesn’t know that user is logged in. You’ve gone a bit deeper and noticed that it is due to some cookies and the another endpoint /start being called in usual bubble login case. That’s interesting.

I have posted my issue on this thread: Login via backend API needs a refresh?

I have had real hard time convincing Bubble Support that it is not my custom code issue. I don’t know if I have even now convinced them.