1 00:00:00,210 --> 00:00:06,510 Let's look at the options for authenticating our users before we even touch the FIREBASE database side 2 00:00:06,510 --> 00:00:06,920 of things. 3 00:00:07,530 --> 00:00:13,740 Now, authentication is common across all of the firebase products, as in once you're authenticated, 4 00:00:13,740 --> 00:00:19,320 you can have rules for that particular user that allow them to access certain parts of your firebase, 5 00:00:19,320 --> 00:00:22,370 of your database, whatever it is, in certain ways. 6 00:00:22,370 --> 00:00:29,130 So you have to be very careful with authorization and only allow people what they should be authorizing. 7 00:00:29,340 --> 00:00:33,510 So never turn everything on and then remove functionality instead. 8 00:00:33,510 --> 00:00:39,420 Add functionality as you require it, require it, but keep it very, very limited. 9 00:00:39,420 --> 00:00:45,390 Otherwise you could end up with a massive firebase bill because users are abusing your service. 10 00:00:45,990 --> 00:00:52,980 OK, so I'm on the FIREBASE Documentation website and that is at five based at Google dot com slash 11 00:00:52,980 --> 00:00:55,800 docs and then select iOS. 12 00:00:56,370 --> 00:01:00,750 And then if we scroll down, we can look at all the various products that we have at the site here. 13 00:01:01,200 --> 00:01:05,100 Let's just look at analytics for now and an introduction. 14 00:01:07,080 --> 00:01:12,780 OK, so it's going to say blah, blah, blah, you can do this, that and the other, how does it work? 15 00:01:12,780 --> 00:01:13,620 Where does it work? 16 00:01:13,990 --> 00:01:15,470 Let's just get started, shall we? 17 00:01:16,770 --> 00:01:18,540 And let's click the iOS version. 18 00:01:21,900 --> 00:01:23,800 Why are we on analytics? 19 00:01:23,830 --> 00:01:25,610 Because I clicked the wrong thing, did I? 20 00:01:26,710 --> 00:01:29,980 I'm sure I clicked authentication anyway. 21 00:01:32,140 --> 00:01:36,590 Let's go to iOS and sign in with a pre-built UI, right? 22 00:01:36,670 --> 00:01:40,150 So this is pretty new in Firebase as far as I'm concerned. 23 00:01:40,600 --> 00:01:47,320 They provide you with UI that allows you to let users sign in with their Google account, their Facebook, 24 00:01:47,320 --> 00:01:50,700 Twitter, phone, email, whatever it is doesn't matter. 25 00:01:51,100 --> 00:01:58,150 And that's very, very handy because to implement these five things alone would take so much of our 26 00:01:58,150 --> 00:01:59,620 time and effort as developers. 27 00:01:59,950 --> 00:02:02,520 Much better if someone does it this way for us. 28 00:02:03,070 --> 00:02:06,190 However, we are not going to do it that way. 29 00:02:06,460 --> 00:02:12,790 Instead, we are going to do it manually so you can get a proper understanding of how the OS flow works. 30 00:02:13,030 --> 00:02:18,850 And in most cases, once your app is has taken off and proven itself, you actually want more control 31 00:02:18,850 --> 00:02:20,170 over the Sinon process. 32 00:02:20,440 --> 00:02:27,430 I believe you can still have the Google buttons and Facebook buttons if you want to in your own design 33 00:02:27,430 --> 00:02:27,810 file. 34 00:02:27,940 --> 00:02:30,590 You don't have to use Google's pre-built UI. 35 00:02:31,240 --> 00:02:35,530 Okay, so first of all, we have to set up the sign in methods. 36 00:02:35,860 --> 00:02:39,810 We are going to just use an email address and password. 37 00:02:40,720 --> 00:02:42,430 We are going to do that one. 38 00:02:42,430 --> 00:02:45,640 We're not going to do this one, although I do like the authentication. 39 00:02:45,640 --> 00:02:52,690 So if someone puts an email address in to register, they have to then go to their email inbox and click 40 00:02:52,690 --> 00:02:55,570 the link they sent and then they'll be logged in automatically. 41 00:02:55,810 --> 00:02:56,980 It's called What is it? 42 00:02:56,980 --> 00:02:59,170 Magic link verification, something like that. 43 00:03:00,370 --> 00:03:03,880 Very, very useful for making sure you have the correct email address. 44 00:03:03,880 --> 00:03:09,400 And without having to bother about a password, you never, ever need a password, as it says there 45 00:03:09,400 --> 00:03:10,120 in that line. 46 00:03:10,600 --> 00:03:13,990 I actually have that running in one of my podcast apps that I produced. 47 00:03:14,590 --> 00:03:17,260 So very useful. 48 00:03:17,260 --> 00:03:19,200 You know, you've got the person's email address. 49 00:03:19,210 --> 00:03:20,770 Great for marketing later on. 50 00:03:22,450 --> 00:03:29,500 OK, there is some apple stuff that you need to comply with for Apple and Google and Facebook. 51 00:03:29,740 --> 00:03:31,420 But let's just skip all of that. 52 00:03:33,250 --> 00:03:37,090 We want to go to the firebase console and open the auth section. 53 00:03:37,090 --> 00:03:38,380 So let's go ahead and do that. 54 00:03:39,010 --> 00:03:42,340 I've opened it in a new tab to Chat V3. 55 00:03:45,020 --> 00:03:49,400 And let's go over to authentication, which is at the top left there. 56 00:03:53,100 --> 00:03:55,850 We have a whole bunch of stuff about how we get started. 57 00:03:56,970 --> 00:03:59,010 Let's get started and see what happens. 58 00:04:00,700 --> 00:04:01,280 There we go. 59 00:04:01,300 --> 00:04:08,440 So all the off is currently disabled and Google do that in case they get service abuse, so leave everything 60 00:04:08,440 --> 00:04:10,310 off until users ask for it. 61 00:04:10,720 --> 00:04:12,910 We are just going to have email password. 62 00:04:13,300 --> 00:04:15,280 There's the password, this link down there. 63 00:04:15,280 --> 00:04:16,540 But we'll leave that off for now. 64 00:04:17,110 --> 00:04:19,180 I'm going to hit save and we're done. 65 00:04:19,190 --> 00:04:21,640 That is literally all we need to do. 66 00:04:22,270 --> 00:04:24,880 If we tap uses, this will give us a list of users. 67 00:04:25,270 --> 00:04:29,570 We have templates for the email addresses, password reset emails and what have you. 68 00:04:30,100 --> 00:04:35,590 And then, of course, we have a usage report, which is very important if you want to actually make 69 00:04:35,590 --> 00:04:36,730 money with your app. 70 00:04:37,780 --> 00:04:40,750 So that's the email address password off set up. 71 00:04:41,080 --> 00:04:45,190 Now we can get onto actually creating the auth controller.