Anvil: Web apps with nothing but Python Transcripts
Chapter: User management and authentication
Lecture: Adding the user service

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Well, here we are in our web app
0:02 and we want to add some stuff to say register or login.
0:06 Now, we've already added these event handlers
0:09 so if somebody clicks login here, or they click register
0:12 or logout, we already have the placeholders
0:15 but we need to fill our promise here to do actually
0:18 log them in, and as you just saw
0:21 this all starts with these services.
0:22 There's actually a ton of services we could have.
0:24 Data tables, users, emails, secrets, so on.
0:29 We're going to start in this chapter with users.
0:32 Let's see how we might let them log in.
0:33 Let's say, email and password, and I guess
0:35 we could go ahead and checkoff Google as well, if we want.
0:38 We can allow visitors to register for the site
0:41 we could enforce secure passwords
0:44 can allow them to remember, lets say, up to a year, right?
0:49 That's pretty good.
0:50 We don't need to confirm the email addresses
0:52 although that's a possibility here, right
0:54 so we're going to also say the accounts can be used right away.
0:58 So, that looks like it's all set up here
1:00 and everything's good to go.
1:02 You can see down here, a couple of the things
1:04 that we can configure in terms of
1:06 what we're going to store about the users.
1:09 We'll talk more about this interface
1:10 when we get to databases, but you can add other information
1:13 like we could have a boolean column, or something like that
1:17 about whether a user is Pro.
1:21 Okay, true or false?
1:22 Now, later we're going to let people buy a Pro subscription
1:26 to our account, so let's go ahead and say that our users
1:28 are going to have this is Pro, and you can adjust this later.
1:31 You're not committed to what you're doin' right here.
1:33 Alright, so it looks like our user service is set up
1:36 and notice also that we have the Google API
1:38 and data table service added.
1:41 Data tables because that's where our user data is going to go
1:44 this is actually part of the data table service
1:46 and then when we checked the sign in with Google
1:49 to make that work, we probably have to go and configure our
1:52 API over here, right, things like this.
1:55 We're not going to do that for now, just leave it alone, right?
1:58 We'll just login with username and password.
2:00 Okay, it looks like our user service is set up, and in fact
2:04 all we have to start doing is calling from our code
2:07 and we have full user support.