User accounts
This article covers how you create and manage users in your app

In this article, we'll look at how Bubble handles setting up and managing user accounts.
Technically, users are just another data type in your app's database. But user accounts carry a lot of responsibility, so Bubble treats the User data type a bit differently from the rest:
Secure credentials
Passwords are hashed and salted, and user data is encrypted both in transit and at rest.
Signing up and logging in
Creating accounts, logging users in, and remembering them between sessions is handled for you.
Account security features
Email confirmation, password resets, two-factor authentication (2FA), magic login links, and temporary passwords are built in.
Temporary users
Visitors who haven't signed up get a temporary user. Data saved on that user carries over when they sign up, which is useful for things like a shopping cart.
Privacy rules
Privacy rules can compare a record with the current user, so you can control access to data based on who the user is and what's stored on them.
Account security is hard to get right, and it works much the same way across most apps. That's why Bubble takes care of the underlying mechanics: it saves you development time and keeps the security side of user accounts up to date without extra work on your part.
What is a user account?
Most of us have dozens or even hundreds of user accounts: we're logged in to our phones, our email, social media, forums, and even newspapers. We all know what they are, so let's change perspective a bit: why does an app need user accounts?
The first answer is that not every app does. You can build a highly useful app where nobody ever creates an account, even one that lets visitors add and change things in the database. So it's worth separating two ideas: your app can have users, registered users, or both. Every visitor is a user, but only those who sign up become registered users. This article focuses on registered users, meaning users who have signed up with an email and password or through a third-party service.
Registering users serves many purposes:
Keeping data private
In many apps, a user should only see their own data, or the data of a select group of other users.
Saving settings
Users can save preferences and profile details that are still there the next time they use the app.
Controlling access
Some apps only let registered users access their pages.
Assigning roles and permissions
Once you can identify each user, you can assign roles that control what they're allowed to see and do.
Personalization
Apps like social networks and e-commerce stores can show each user a personalized stream of content.
Teaming up
Apps where people share data and collaborate need to know who each person is to control who has access to what.
Payment processing
Orders and payment history are usually attached to a permanent user.
Communication
Knowing who your users are lets you reach them in the app or through channels like email.
As you can see, user accounts aren't only about security and privacy. Just like any other data type, you can add as many fields to the User data type as you need. The User type also comes with a few fields of its own to handle the account. These can't be changed or deleted, and they're the same in every Bubble app.
Built-in fields
Like other data types, the User type has a set of built-in fields. On top of those, it comes with three fields of its own:
Yes
The user's email address, used to sign up and log in.
Password
No
The user's password, stored as a secure hash.
Email confirmed
No
A yes/no value that shows whether the user has confirmed their email.
The email field can't be empty on a registered user, and it needs to be a valid email address. Every user in your app needs a unique email address, so two users can't sign up with the same one.
Password
The password field is different from every other field: it's invisible, even to you as the app developer. Bubble stores passwords following industry-standard practices.
Email confirmed
The Email confirmed field is also invisible. It holds a yes/no value that shows whether the user has confirmed their email address. The value changes to yes when the user clicks the link in a confirmation email, sent either by the Send confirmation email action or by the Sign the user up action with Send an email to confirm the email checked.
You can't change this field directly. Only the user can update it, by confirming their email.

Current User's email confirmed.Signing up users
This article covers the most common actions for user accounts, but not every one. To see all the actions and operators available for users, check out the references below:
Reference: Account actions Reference: User operators
Bubble handles the technical side of signing users up, but the design and user experience are entirely up to you.

To sign a user up, you need two pieces of text from them: a valid email address that isn't already in use in your app, and a password. You collect these with input elements and pass them to the Sign the user up action.

The Sign the user up action has these main properties:
The email address the user signs up with.
Password
The password the user chooses.
Require a password confirmation
When checked, the user types their password twice, and the two have to match.
Send an email to confirm the email
When checked, Bubble sends the user a confirmation email right after they sign up.
Change another field
Lets you save other fields on the new user at the same time, such as their name.
Setting up a signup form
Add the input elements
Add an input for the email address and one for the password. If you want users to confirm their password, add a second password input.
Set the email input's content format to Email and the password inputs' content format to Password, so the email is validated and the password characters are hidden.
The email and password are sent to Bubble's server encrypted, and the password is hashed and salted, so no one can read it, not even the Bubble team.
As soon as the action runs, Bubble creates the account and the user is logged in. The session lasts for 365 days, or until the user logs out or clears the cookies in their browser.
Logging users in
Logging a user in works much like signing them up. The Log the user in action needs two inputs: the email and the password. Bubble sends them to the server encrypted to check the credentials, and if both are correct, the user is logged in.
The Stay logged in property controls how long the session lasts:
Checked
365 days
Unchecked
24 hours
A common setup is to add a Remember me checkbox to your login form and use its value for the Stay logged in property, so each user can choose.
Signing up and logging in with a third-party service
Instead of an email and password, you can let users sign up and log in with an account they already have, such as Google, Facebook, LinkedIn, or X (Twitter). This is often called social login, and it works through a standard called OAuth.
Third-party login has a couple of advantages:
Users can sign up in a few clicks and don't need to remember another password.
Depending on the service and the permissions the user grants, your app can also fetch data on their behalf, such as their email address or profile picture.
Bubble offers plugins for several services, and you can find more in the plugin marketplace. You can also connect to other providers with the API Connector.
Example: logging in with Facebook
Let's say your app has a button labeled Log in with Facebook.
When you set up this flow, you define the level of authorization your app needs. By default, most services only share the user's public profile and email address, but you can ask for more permissions if your app needs them.
Only ask for the permissions your app actually uses. It's better for your users' privacy and security, and a long list of permission requests can lead to fewer users signing up.
When a user signs up with Facebook, Bubble creates a new user in the database, just like a regular signup with an email and password. The difference is how they log in later. Since they never set a password, they log in with Facebook again. If they're already logged in to Facebook in the same browser, that's usually a single click.
Mixing traditional and social logins
A user can have both a traditional login and one or more social logins. This can play out in a few different ways, which we cover in the article series below:
Article series: OAuth plugins
Temporary users
Signing a user up gives them an email address and a permanent place in your database. In many cases, it's also when they choose a password.
But Bubble starts keeping track of who the user is before that. When someone visits your app for the first time, Bubble saves a cookie in their browser and creates a temporary user. That lets you remember who the user is during their visit and build logic that relies on data stored on the current user, such as:
Saving preferences and settings
Storing a shopping cart
Personalizing the experience
A temporary user stays active on the same device for 72 hours. When the user signs up, Bubble automatically transfers the data stored on the temporary user to their new account.
There's one exception: in the Settings tab, you can stop Bubble from setting cookies on new visitors automatically. If you do, Bubble doesn't create a temporary user until the visitor accepts cookies through the Opt-in to cookies action. Until then, anything stored on the current user is lost when they close the browser tab.
User accounts in native mobile apps
Bubble for native mobile apps uses the same user accounts as your web app within the same project. A user who signs up on the web can log in to your iOS or Android app with the same credentials, and the other way around.
Sign the user up and Log the user in
Work the same way as in your web app.
Signup/login with a web browser
Only available in native mobile apps. Opens a page from your web app to sign up or log in the user, so you can reuse your existing signup and login page instead of building a separate one for mobile. Supports email and password login, OAuth login, and 2FA.

Other account actions
Beyond signing up and logging in, Bubble includes actions for most of the account tasks your app is likely to need:
Send confirmation email
Sends the user an email with a link to confirm their email address.
Send password reset email
Sends the user an email with a link to reset their password. Reset links are valid for 24 hours.
Reset password
Sets a new password for a user who followed a password reset link.
Send magic login link
Sends the user a link that logs them in without a password.
Update the user's credentials
Changes the current user's email or password. Requires their current password.
Assign a temp password to a user
Generates a temporary password for a user. Temporary passwords don't expire automatically.
Create an account for someone else
Creates a new user account without logging anyone in, such as when an admin invites a user.
Log the user out
Logs the current user out.
Log out other user's sessions
Logs the current user out on all other devices.
Opt-in to cookies and Opt-out from cookies
Lets users accept or decline the cookies Bubble sets.
2FA actions
A set of actions for setting up, checking, and disabling two-factor authentication.
Reference: Account actions
FAQ: User accounts
Other ways to learn
Last updated
Was this helpful?