Anvil: Web apps with nothing but Python Transcripts
Chapter: User management and authentication
Lecture: User services in Anvil
0:00 What fun would our app be
0:01 where we are going to store things like measurements
0:05 over time and personalized information
0:08 without having some kind of account?
0:10 Luckily, Anvil makes it super easy for us
0:13 to create accounts, log in with username and password
0:16 or even things like using your Google account
0:18 or other accounts like that, even Enterprise accounts.
0:21 And it makes sure that it happens in a nice and secure way.
0:25 Creating basic accounts is tricky.
0:27 We got to make sure we store the password correctly.
0:29 And oh, what if they've got to reset their password?
0:31 Now we have to be able to send email.
0:32 There's all sorts of stuff around
0:34 user management and accounts.
0:35 It turns out to be pretty tricky
0:37 in from scratch web applications
0:39 that Anvil's going to handle for us.
0:42 All of this starts with the User Service.
0:45 When you create a new project
0:46 it doesn't have a User Service.
0:47 But, there's a Services section
0:49 and you just add the User Service
0:50 and configure it as you want.
0:52 So you'll see, we're going to go over there
0:53 and we're going to click on the User Service
0:55 and add it to our application.
0:57 Then we get to pick how users can interact with our site.
1:01 How do we want them to log in?
1:02 We can say only active directory
1:04 which is a way to basically have a single account
1:07 within your company, managed by your company.
1:10 We could have the traditional username or password.
1:13 We could have sign in with Google or Facebook, certificates.
1:16 We could actually do all of these things
1:17 if we had the Enterprise plan.
1:19 So here you can see, we can configure whether
1:21 you could be remembered across sessions
1:23 how long that should be for, and so on.
1:26 So all this stuff we have to do to have
1:27 a nice user interaction, Anvil just makes it a checkbox.
1:31 That's what we're going to do in this chapter
1:33 is we're going to configure this
1:34 and then integrate it into our application.
1:36 You can see the little sample code at the top
1:38 anvil.users.login with form.
1:41 That's a pretty simple way to get started
1:42 and I think we'll start there.