The Users Service handles signup, login and user permissions, and provides a range of functionality to make user management easy and flexible. See the Quickstart for logins and the Quickstart for permissions to get up and running quickly.
To add user management to your app, you must first enable the Users Service in the App Browser:
You can present a signup/login form with a single line of code. This handles signup, login, email verification, password reset and ‘remember me’. See Presenting a Login Form for details.
If you want to build your own login form or customise your signup/login workflow, see our how-to guide.
There are also a number of functions such as
anvil.users.logout() that let you run the steps of the user management process manually.
See Logging in Using Code or the API Reference to learn what functions are available.
In addition to username and password, you can allow your users to log in with their existing Google, Facebook or Microsoft accounts. Anvil also has built-in local Active Directory (AD) and PKI Certificate systems for Enterprise users, and supports SAML Authentication. See Authentication Choices for more information.
Anvil’s Users Service also comes with Two-Factor Authentication. See Two-Factor Authentication for more detail.
If you’re using the Users Service, user accounts are stored in a Data Table called ‘Users’. The password is
for you and the rest of the relevant user details are processed and added to the ‘Users’ Data Table. See the Users Table for more information.
You can add your own columns to this Data Table - it’s common to add a
role column to store user roles for permissions
You can get the currently logged-in user using
anvil.users.get_user(). This returns a row from the Users table.
This allows you to set up Python code in your Server Modules that checks usernames or roles before running particular code or returning particular data. This is Anvil’s authorisation model. See User Permissions for more detail.