User Accounts

Let users sign up and sign in to your app

User Accounts let you create apps with users.

Here's why it's powerful:

  • Private pages: require sign in to view certain Pages, like profiles.

  • Protect actions: require sign in to run certain Functions, like sending email.

  • Personalization: store and show user-specific information, like posts.

  • Grow your users: invite teammates, customers, or communities to sign up for your app

Getting Started

Turn on User Accounts for the project:

  1. Choose "Enable User Accounts" for the project from the top left Create logo menu.

  2. Once enabled, a Database to store your Users is created, named "[Project Name] Users"

Then, to Require Sign In for specific Pages or Functions in your project:

  1. Head to the "Users" tab for the Page or Function

  2. Choose "Require sign in to view"

  3. Publish the project to see changes

How It Works

Once User Accounts are enabled:

  • A User Accounts database stores everyone that signs up for the project.

    • You can view or use this Database from the "Users" tab in a Function or Project or the add-ons menu.

  • Your project gets Sign in, Sign up, and Sign out pages.

    • You can see them in the project, but for now, you can not customize them (we will allow customization soon)

    • If you want to route your users to them manually, their routes are in the Users tab of any Page or Function. You can also link to them in the Design tab when you tap on an element.

  • Page or Function prompts with the phrase signed in user tell Create to write code that access the signed in user's information.

  • Users who are not signed in who try to access a protected Page or Function are redirected to a sign-in page.

    • They can sign up or sign in with email and password.

    • After they sign up, their info is stored in the Users Database.

    • They are then sent back to your Page or Function as a signed in user.

User fields

The Users Database comes with some built-in fields:

  • Email (unique identifier for each user)

  • Password (securely hashed with randomized salt and not directly accessible)

You can add additional custom fields to store user-specific information as needed.

For example:

  • You could create a signed in enabled profile Page that lets the user update their name, email, and other information.

  • You could create a signed in Function that updates a specific user's role if the user using the Function has the right role.

Using User Information

You can use user information in Functions and Pages:

  • Use your Users database in your Page or Function prompt by adding it from the add-ons menu, like any other Database.

  • You can reference the "signed in" or "current user" in your prompt in plain text. Create will understand what you mean and turn it into code that accesses the current signed in user's information. For example:

    • Page: "Have the header say 'Welcome [current user email]'"

    • Function: "If the signed in user is an admin role, send an email with Sendgrid"

Customizing Login, Logout

Letting users log out is easy:

  1. After enabling User Accounts, you get a route for logging out users in the Access tab of any Page or Function.

  2. Create a "Log Out" button that sends users to this route.

Example: "Create a Log Out button that sends users to the [your route here]"

Use Cases

Here's some inspiration of what you can build with User Accounts:

  1. Personalization: Show information specific to the signed in user, like their posts or order information.

  2. Membership: Build tools where only registered or paying users can access premium articles, videos, or resources.

  3. Purchases: Make stores where individual users can check out for items and manage orders

  4. Internal tools: Make apps and sites that only specific users can access

  5. Private integrations: Make functions that only allow authorized users to access a specific 3rd party service

  6. Social: Create community sites where users have profiles, can post content, and interact with others.

  7. Customer and Support Portals: Build systems where users can submit and track their support tickets, feedback, or see status.

  8. Collaboration: Develop team collaboration tools where users can share documents, assign tasks, and communicate.

Testing Your Sign In

You can test your User Accounts setup:

  1. Enable User Accounts for a page or function.

  2. Publish the page or function.

  3. Try to access it in an incognito browser window.

  4. You should be redirected to the sign-in page.

  5. Create a test account and verify you can access the protected content after signing in.

Troubleshooting

If you're having issues with User Accounts:

  • Double-check that User Accounts is enabled for your project.

  • Verify that it's enabled for the specific page or function you're testing.

  • See what's in your Users database.

  • Test the login process with a test account.

If you need help getting your User Accounts to work, join our Discord and post in the "help-me-build" channel.

FAQs

Q: Can I customize the sign-in page?

For now, Create does not allow you to customize the sign in page

Q: Is there a way to implement social login (e.g., Google, Facebook, Twitter)?

Not at the moment. It is on our roadmap.

Q: Can I add additional fields to the user profile beyond email?

Yes. You update the Users database in your prompt for your Pages and Function OR you can create other databases that associate information with the signed in user.

Last updated