Live Chat

We'll need to share your messages (and your email address if you're logged in) with our live chat provider, Drift. Here's their privacy policy.

If you don't want to do this, you can email us instead at

Quickstart: Login

Add signup/login to your app

Anvil has a built-in user management system that makes login and permissions easy.

Follow this quickstart to set up a signup/login form (user authentication).

Create an app

Log in to Anvil and click ‘New Blank App’. Choose the Material Design theme.

Location of the Create App button

Add the Users Service

In the App Browser, click the + next to Services.

App Browser showing the plus next to Services

You’ll see a list of available services and integrations. Click on Users.

Services list with Users highlighted

Add a login form to your app

Under Forms in the App Browser, select Form1.

App Browser showing where to find Form1

Click on the ‘Code’ tab to see the Python code for Form1.

The Design View for Form1 with the Code tab in the top-right highlighted

You will see a few lines of pre-written code. Your Form is represented as a class called Form1. It currently has only one method, the __init__ method.

The Code View for Form1

At the end of the __init__ method, write this line:


Run your app

Now click the ‘Run’ button at the top of the screen.

Running your app in the editor

Your app will display a login form.

A login form with username and password inputs, plus 'sign up' and 'forgot your password' links

Sign up and verify your email address, then stop the app to return to the editor. (You may have opened the app in a new tab when you verified your email, in which case close that tab, then stop the app in your original tab.)

See the user in the database

Click on Data Tables under Services in the App Browser.

The App Browser with Data Tables circled.

You should see a table called Users, containing one row - the user record for the email address you signed up with.

Users table in Data Tables showing email, password hash, and other information

Notice that your password has been hashed by Anvil (using the bcrypt algorithm). This means somebody with access to the Data Table cannot work out your password. It is the standard best-practice way to store passwords on the web.

Check you can log in

Add this line to the end of the __init__ method in Form1:

    print(f"This user has logged in: {anvil.users.get_user()['email']}")

This will get the logged-in user and print that user’s email address.

Run your app and log in. You will see your email address printed in the Output Panel.

The Output Panel showing a message reading 'This user has logged in:

Copy the example app

Click on the button below to clone a finished version of this app into your account.

Third-party integrations

The app you’ve built creates new user accounts based on an email address and password. You can also allow users to log in in with their existing accounts in third-party services and other systems:

The Users Service UI showing check boxes for Anvil's built-in user auth integrations.

Here are the built-in options:

You can also build your own OAuth flows using Anvil’s HTTP library. You can clone this example app, which authenticates against Auth0’s OAuth system, and modify it slightly for your system of choice.

Next up

Want more depth on this subject?

Read more about User authentication and authorisation.

Want another quickstart?

Every quickstart is on the Quickstarts page.