1
00:00:08,160 --> 00:00:09,410
Everyone welcome back.

2
00:00:09,410 --> 00:00:11,540
Joining me here with Dave Slocum dot com.

3
00:00:11,630 --> 00:00:16,460
And in this lesson we are going to work on logging in the user.

4
00:00:16,460 --> 00:00:23,630
So up till now the only way to kind of log in is to actually create an account but I'm getting tired

5
00:00:23,630 --> 00:00:25,380
of creating accounts every single time.

6
00:00:25,400 --> 00:00:29,020
So we're going to get this whole logging issue fixed.

7
00:00:29,060 --> 00:00:31,750
All right so what what do we need to do.

8
00:00:32,060 --> 00:00:37,670
Well Mr. Postman and I want to show you what what's going on here.

9
00:00:37,700 --> 00:00:43,440
So when we log in a user Let's see here we can log in with this account.

10
00:00:43,550 --> 00:00:53,570
So when I log in what is returned to us is a turn off to an ok and a user name and we save that into

11
00:00:53,570 --> 00:00:58,640
the user defaults for the user and the off token.

12
00:00:59,060 --> 00:01:05,180
But that doesn't give us the other information we need which is the user name the avatar image the background

13
00:01:05,180 --> 00:01:07,060
color and those other things.

14
00:01:07,070 --> 00:01:13,160
So the only one the only function that we have so far that gives us that information is when we add

15
00:01:13,190 --> 00:01:14,830
a user we get back.

16
00:01:15,020 --> 00:01:21,200
This chase on object right and that contains all of the user infor information that we need.

17
00:01:21,290 --> 00:01:25,270
So we're going to need a new function and the API provides us one.

18
00:01:25,280 --> 00:01:30,410
And that's that function is called the find use or by email function.

19
00:01:30,410 --> 00:01:32,020
All right and so it's this route right here.

20
00:01:32,030 --> 00:01:40,490
So user by e-mail and then at the end you append the user's e-mail and that function actually returns

21
00:01:40,550 --> 00:01:43,580
the exact same Jaison as the AD user.

22
00:01:43,630 --> 00:01:43,970
OK.

23
00:01:44,090 --> 00:01:48,400
So that gives us the idea about a color avatar name email and name.

24
00:01:49,100 --> 00:01:50,450
So this is what we're going to work on.

25
00:01:50,450 --> 00:01:56,960
First we're going to create a new function that can go and fetch that information based just on the

26
00:01:56,960 --> 00:01:59,970
users email that we get after we log in.

27
00:02:00,020 --> 00:02:00,450
OK.

28
00:02:00,650 --> 00:02:06,500
So we get the users email in off token then we use that email and auto can to get the rest of their

29
00:02:06,500 --> 00:02:07,040
information.

30
00:02:07,040 --> 00:02:07,620
All right.

31
00:02:07,880 --> 00:02:09,380
So let's get to it.

32
00:02:09,380 --> 00:02:13,130
We're going to do this in the off service Dodsworth file.

33
00:02:13,340 --> 00:02:17,240
And come down here to the bottom and create a new function.

34
00:02:17,240 --> 00:02:23,060
We're going to call this funk find user by email.

35
00:02:23,230 --> 00:02:23,820
OK.

36
00:02:24,140 --> 00:02:30,170
And this one we don't actually need to pass anything into it except for we're just going to have our

37
00:02:30,200 --> 00:02:38,620
completion handler so we can say at it's keeping it and completion handler.

38
00:02:39,280 --> 00:02:40,340
All right there we go.

39
00:02:40,840 --> 00:02:46,750
So first off let's go ahead and create our You're all going to open.

40
00:02:46,900 --> 00:02:49,270
Run over to utilities where you.

41
00:02:49,270 --> 00:02:52,310
Here you go Constance and our next.

42
00:02:52,460 --> 00:03:07,450
Your help is called Let your underscore user by e-mail that is going to equal the base you are l and

43
00:03:07,480 --> 00:03:18,750
then need some quotation marks because you are l and then user slash by email slash.

44
00:03:19,150 --> 00:03:26,380
And then over in our office service we're going to append to that the users email but we'll get to that

45
00:03:26,380 --> 00:03:27,450
in a second.

46
00:03:27,880 --> 00:03:28,530
All right.

47
00:03:28,540 --> 00:03:32,980
And we don't actually need a body we don't need to do any lowercase e-mail or anything.

48
00:03:32,980 --> 00:03:37,920
We will need the bearer header but we have that saved as a.

49
00:03:37,930 --> 00:03:39,090
Or do we.

50
00:03:39,430 --> 00:03:40,480
Oh no we do not.

51
00:03:40,600 --> 00:03:40,800
OK.

52
00:03:40,810 --> 00:03:42,260
So we need.

53
00:03:42,290 --> 00:03:44,340
We're going to be using this right here.

54
00:03:44,380 --> 00:03:46,960
And so since we'll be using it in multiple locations Go ahead.

55
00:03:46,960 --> 00:03:49,460
And I'm just going to cut this header.

56
00:03:49,470 --> 00:03:52,070
This is from the create user function.

57
00:03:52,090 --> 00:03:53,260
I'm cutting that header.

58
00:03:53,260 --> 00:03:59,320
And we're going to jump down here to our hitter's section and I'm going to call this better.

59
00:04:01,230 --> 00:04:01,790
Header.

60
00:04:01,950 --> 00:04:05,970
OK because this is the header that contains the authorization token.

61
00:04:06,250 --> 00:04:06,610
OK.

62
00:04:06,620 --> 00:04:07,580
Copy that.

63
00:04:07,740 --> 00:04:10,580
And then go back to our service that swift.

64
00:04:11,250 --> 00:04:17,650
And here we're going to replace Heather here with Verrier header.

65
00:04:17,960 --> 00:04:19,080
OK.

66
00:04:19,620 --> 00:04:19,830
All right.

67
00:04:19,830 --> 00:04:22,010
So now we're back in the find user by e-mail.

68
00:04:22,010 --> 00:04:27,840
We've created a constant for the bearer authorization token header and now we're going to create our

69
00:04:27,840 --> 00:04:30,120
find user by e-mail.

70
00:04:30,120 --> 00:04:38,460
Alamo fire a request from K-Swiss the Alamo fire request and I'm going to use the same one we've been

71
00:04:38,460 --> 00:04:44,400
using this time although we're going to have to do a little bit of string interpolation.

72
00:04:44,400 --> 00:04:54,300
We're going to start with the your L by user or user or by email and then we are going to add onto that

73
00:04:55,230 --> 00:04:58,510
the user e-mail.

74
00:04:59,150 --> 00:05:05,400
OK I remember this function is going to be called directly after we call the logging function right

75
00:05:05,400 --> 00:05:10,570
here which saves to our user defaults the user e-mail and the tokens.

76
00:05:10,570 --> 00:05:17,550
So that's why we have access to those in this function and the type is what is the type.

77
00:05:17,550 --> 00:05:19,410
It might be a good actually.

78
00:05:19,410 --> 00:05:19,690
Yes.

79
00:05:19,690 --> 00:05:21,340
So this function is actually a get.

80
00:05:21,470 --> 00:05:25,220
So this will be our one of our first methods here.

81
00:05:25,440 --> 00:05:31,870
So to do that we just say don't get the parameters are.

82
00:05:31,880 --> 00:05:35,250
And no we don't have a body to pass this time.

83
00:05:35,280 --> 00:05:47,970
The encoding is Loeb's encoding is on in coding default and the headers is our constant header that

84
00:05:47,970 --> 00:05:49,060
we just created.

85
00:05:49,470 --> 00:05:54,240
And the response is a response or response to Jaison.

86
00:05:54,520 --> 00:05:59,400
I'm going to press going to close the side page to give us a little bit more room and clicking here

87
00:05:59,820 --> 00:06:08,370
pressing enter and renaming the data response to just response and then getting rid of that placeholder

88
00:06:08,370 --> 00:06:09,510
for code.

89
00:06:09,900 --> 00:06:20,030
Ok so now we are doing essentially exactly the same thing as we did in the create user function now.

90
00:06:20,270 --> 00:06:20,690
OK.

91
00:06:20,880 --> 00:06:29,460
So I could actually just copy this entire section here from the create user because the response and

92
00:06:29,460 --> 00:06:34,030
the sun is exactly the same like we saw in Postman.

93
00:06:34,050 --> 00:06:38,370
So here is the response for the user.

94
00:06:39,120 --> 00:06:43,670
And here it is for the find user by email.

95
00:06:44,030 --> 00:06:44,780
OK.

96
00:06:45,030 --> 00:06:48,690
But we don't want to violate the dry principle.

97
00:06:48,690 --> 00:06:49,020
Right.

98
00:06:49,020 --> 00:06:59,110
So what we need to do is we're going to go ahead and just extract out all of this right here.

99
00:06:59,410 --> 00:07:00,000
OK.

100
00:07:00,000 --> 00:07:02,100
So I'm going to cut this.

101
00:07:02,140 --> 00:07:09,350
I'm going to create a new function called phunk set user info.

102
00:07:09,510 --> 00:07:19,620
And into that we are going to pass data of type data and then I'm going to paste what we just cut and

103
00:07:19,620 --> 00:07:24,690
then right up here where we cut it from I'm going to call that function that we just created.

104
00:07:24,720 --> 00:07:31,520
I mean to say self set the user info data and we're going to pass into it this data right here that

105
00:07:31,530 --> 00:07:34,030
we're getting from the response.

106
00:07:34,230 --> 00:07:34,590
All right.

107
00:07:34,590 --> 00:07:43,230
So basically all we're doing is if the response error isn't all we're going to extract the data from

108
00:07:43,230 --> 00:07:49,380
response then we're going to pass that data into this function right here which is essentially the same

109
00:07:49,380 --> 00:07:57,510
thing that we did and our create user account or a function in which we extract the ID color avatar

110
00:07:57,510 --> 00:08:05,700
name email name past those into the function over in our user data service which is used to set the

111
00:08:05,970 --> 00:08:10,760
private privately set variables inside of our user data service.

112
00:08:10,890 --> 00:08:11,600
Okay.

113
00:08:11,880 --> 00:08:17,070
And then appear in our create user we can do a little bit of refactoring here as well.

114
00:08:17,190 --> 00:08:27,780
So I can delete this and say self not set user info data and then Pessin the data right there as well.

115
00:08:27,780 --> 00:08:29,840
All right so I'm going to save that.

116
00:08:30,900 --> 00:08:39,780
And now we have a way at any point to as long as we have a valid email to make an API request and retrieve

117
00:08:39,870 --> 00:08:43,830
the information for that for any specific user.

118
00:08:43,860 --> 00:08:46,600
Just by passing in the users email right here.

119
00:08:46,650 --> 00:08:47,220
OK.

120
00:08:47,430 --> 00:08:55,050
So let's let's use that over here in the log in view controller and we haven't actually done much working

121
00:08:55,050 --> 00:09:00,090
here so we're going to need to add a bunch of outlets and do some work here.

122
00:09:00,090 --> 00:09:01,860
All right so the go ahead and do that.

123
00:09:02,290 --> 00:09:08,360
First let's go ahead and add a spinner and just like we did in our create an account we're going to

124
00:09:08,590 --> 00:09:18,970
win our right pane search for activity indicator and I'm going to just drop that in right here and we're

125
00:09:18,970 --> 00:09:24,720
going to look at attributes and Specter said the style to large white and then change the color to our

126
00:09:24,760 --> 00:09:32,140
purple that we've been using then we're going to select the A line constraint right here and say horizontal

127
00:09:32,140 --> 00:09:38,860
and vertical the container and then I'm going to go to the size inspector and select the align center

128
00:09:38,860 --> 00:09:42,690
to Y and enter in minus 100 as a constant.

129
00:09:42,820 --> 00:09:48,360
And that just pop it up for us right there that looks good.

130
00:09:48,850 --> 00:09:53,770
And I'm going to save that and then I'm going to open up our assistant editor by holding option and

131
00:09:53,770 --> 00:10:02,440
clicking on the log and we see right here we go and we are going to need outlets for the username password

132
00:10:02,710 --> 00:10:04,240
and the spinner.

133
00:10:04,240 --> 00:10:09,110
Ok so can I create a little section for outlets.

134
00:10:09,820 --> 00:10:15,400
And with the username label or a text field selected and control dragging.

135
00:10:15,550 --> 00:10:22,100
And I'm going to call this user name text as it connect.

136
00:10:22,170 --> 00:10:29,090
Then for the password same thing control drag and I'm on the save password text to 60.

137
00:10:30,020 --> 00:10:41,580
And finally for the spinner going to control drag and say spinner I'm going to connect those and then

138
00:10:41,600 --> 00:10:44,150
see here close pressed create account button.

139
00:10:44,250 --> 00:10:46,190
Looks like we also need a log in.

140
00:10:46,610 --> 00:10:47,080
OK.

141
00:10:47,240 --> 00:10:55,010
So we're going to just put that right here holding log in control dragging and I'm going to say loggin

142
00:10:55,160 --> 00:10:57,920
pressed when I change that to an action.

143
00:10:58,370 --> 00:10:59,300
And that looks good.

144
00:10:59,300 --> 00:11:02,060
So connect.

145
00:11:02,190 --> 00:11:08,600
All righty then let's go ahead and go back to our standard editor and let's get to work.

146
00:11:08,600 --> 00:11:17,180
So let's jump back into our log NBC and do a little bit of you set up first just like in our create

147
00:11:17,180 --> 00:11:17,920
account B.

148
00:11:17,930 --> 00:11:23,220
We're going to want to change the placeholder text of these two text fields.

149
00:11:23,420 --> 00:11:30,370
So let's create a function for setting up the you and I say phunk set up a.

150
00:11:32,460 --> 00:11:35,060
And instead of writing all that out.

151
00:11:35,060 --> 00:11:41,690
Again I'm just going to go back into our create a count b c and steal a couple of these and I'm going

152
00:11:41,690 --> 00:11:49,310
to copy that and jump back into the log and the C and paste that and then just replace looks like that

153
00:11:49,310 --> 00:11:59,760
was already the same and replace this one here username and change the placeholder text to password.

154
00:12:00,860 --> 00:12:02,110
And that should be good.

155
00:12:02,110 --> 00:12:04,380
And then we're going to hide the spinner to start out.

156
00:12:04,510 --> 00:12:10,180
So spinner is hidden is equal to true.

157
00:12:10,730 --> 00:12:12,700
And I'm going to save that.

158
00:12:13,430 --> 00:12:18,710
So now the last thing in our log in the see that we need to do is that well first we need to of course

159
00:12:18,920 --> 00:12:20,610
call the function that we just created.

160
00:12:20,630 --> 00:12:22,670
I always forget that one set up right here.

161
00:12:22,880 --> 00:12:25,450
All right and then here for the log impressed.

162
00:12:25,460 --> 00:12:28,520
So what's going to happen when we press the button.

163
00:12:28,550 --> 00:12:36,710
We are first going to log the user in with the username and password that they entered then we are going

164
00:12:36,710 --> 00:12:44,810
to go through the off service type instance a logging user where we will log in through the API which

165
00:12:44,810 --> 00:12:53,000
will return to us the users e-mail and the off token we save those into service and then we use the

166
00:12:53,000 --> 00:13:00,560
find user by e-mail to go ahead and populate all of our user data service information that we need to

167
00:13:00,560 --> 00:13:06,680
do things like show the avatars images and usernames et cetera.

168
00:13:06,680 --> 00:13:07,040
All right.

169
00:13:07,160 --> 00:13:10,160
So let's go ahead and get started.

170
00:13:10,260 --> 00:13:12,410
First thing we're going to do is say spinner

171
00:13:15,410 --> 00:13:18,030
is hidden is equal to false.

172
00:13:18,050 --> 00:13:21,370
So once we click it the spinner is going to pop up and we're going to start it.

173
00:13:21,380 --> 00:13:28,370
And the meetings I'm going to say spinner that is animating or I should say start animating spinner

174
00:13:28,400 --> 00:13:33,340
to start animating.

175
00:13:33,340 --> 00:13:35,340
And then we are going to make our.

176
00:13:35,780 --> 00:13:39,090
Then we're in unwrap our username and password.

177
00:13:39,110 --> 00:13:45,850
So when I say guard let username is equal to username

178
00:13:49,490 --> 00:13:58,190
text come on use a name text dot text where and this is just to do a check to make sure that we have

179
00:13:58,460 --> 00:13:59,660
that we don't have an empty string.

180
00:13:59,720 --> 00:14:10,590
When I say user name text that text does not equal an empty string and it closes right pain.

181
00:14:10,820 --> 00:14:18,010
Else we are just going to return out of this function and then same thing for the password.

182
00:14:18,020 --> 00:14:24,920
So I'm going to copy this and paste it and say Pass is equal to.

183
00:14:24,920 --> 00:14:29,980
Copy this password text that text where past for text or text is not equal to an empty string.

184
00:14:30,080 --> 00:14:31,250
Else return.

185
00:14:31,700 --> 00:14:34,230
OK so then we can call our loggin function.

186
00:14:34,280 --> 00:14:41,030
When I say off service for instance dot loggin user.

187
00:14:41,120 --> 00:14:44,240
And we're going to pass into it the user name.

188
00:14:44,240 --> 00:14:47,960
So this is actually I I mean these poorly.

189
00:14:47,960 --> 00:14:50,160
The user name is not actually the user's name.

190
00:14:50,180 --> 00:14:52,570
The user name is the e-mail.

191
00:14:52,910 --> 00:14:53,630
But that's OK.

192
00:14:53,800 --> 00:14:55,410
This should actually be e-mail.

193
00:14:55,430 --> 00:14:58,490
So I'm going to change this right here to e-mail.

194
00:14:58,490 --> 00:14:59,020
There you go.

195
00:14:59,240 --> 00:15:04,050
All right so e-mail we're passing the e-mail pass we're going to pass and pass.

196
00:15:04,160 --> 00:15:13,040
Then for the completion hndler press enter to get our closure going to say success and get rid of that.

197
00:15:13,150 --> 00:15:21,230
So when I say if success so if the logon is successful then we are going to use our brand new function

198
00:15:21,230 --> 00:15:24,080
that we just created the find use or by email.

199
00:15:24,080 --> 00:15:36,080
Ok so when I say off service instance dot fine use or by email completion is access and if it's successful

200
00:15:36,130 --> 00:15:45,300
or if success then we have repopulated our user data service information.

201
00:15:45,320 --> 00:15:50,260
We now have the Avatar color name the user name and email.

202
00:15:50,300 --> 00:15:50,750
OK.

203
00:15:50,900 --> 00:15:52,330
So that's great news.

204
00:15:52,430 --> 00:15:53,780
And so at this point.

205
00:15:54,020 --> 00:16:01,910
And we we've logged in what we want to do is we're going to send out our post notification to let everybody

206
00:16:01,910 --> 00:16:06,790
know who cares that we have logged in that the user data has changed.

207
00:16:06,800 --> 00:16:13,980
So that's a good notification center that default dot post and see.

208
00:16:14,480 --> 00:16:18,490
This is the one we want right here.

209
00:16:18,710 --> 00:16:25,320
So the name is known to have underscore you did it change and the object is new.

210
00:16:25,590 --> 00:16:25,900
OK.

211
00:16:25,920 --> 00:16:27,790
Can I say that.

212
00:16:27,800 --> 00:16:29,460
And then just a few of the things that we want to do.

213
00:16:29,480 --> 00:16:34,970
We're going to say self that spinner that is

214
00:16:37,770 --> 00:16:41,880
hid in is equal to true self-taught spinner.

215
00:16:44,220 --> 00:16:45,820
Stop animating.

216
00:16:45,860 --> 00:16:53,740
And then lastly we're going to dismiss so self-taught dismiss animated as true and completion as well.

217
00:16:53,870 --> 00:16:54,070
All right.

218
00:16:54,070 --> 00:16:54,660
Wonderful.

219
00:16:54,660 --> 00:16:55,990
It's going to save that.

220
00:16:56,600 --> 00:17:03,180
And I think that's actually everything that we need here in the log in B C for now and forever actually.

221
00:17:03,290 --> 00:17:04,970
So I think this one is done.

222
00:17:05,290 --> 00:17:07,380
Yeah let's go ahead and test it out I'm going to run.

223
00:17:08,540 --> 00:17:09,360
Already.

224
00:17:09,350 --> 00:17:23,770
So when I open this up press log in and log in here at E dot dot com password 1 2 3 4 5 6 and Lagann

225
00:17:24,350 --> 00:17:26,670
our spinner up just like we wanted.

226
00:17:27,100 --> 00:17:29,260
Oh hey there we go.

227
00:17:29,260 --> 00:17:35,950
All right so we are successfully logging in or going to log out and try it out one more time with a

228
00:17:35,950 --> 00:17:38,570
different g g dot com.

229
00:17:38,590 --> 00:17:41,780
One two three four five six.

230
00:17:41,940 --> 00:17:42,960
And there we go.

231
00:17:43,200 --> 00:17:47,320
All right so we have logging in covered.

232
00:17:47,540 --> 00:17:47,770
OK.

233
00:17:47,790 --> 00:17:54,270
But I want to show you something if I do command shift and go H.H. then you get this here so I'm going

234
00:17:54,270 --> 00:17:58,710
to close our app so close it and then I'm going to reopen it.

235
00:17:58,710 --> 00:17:59,580
Now we were logged in.

236
00:17:59,580 --> 00:17:59,840
Right.

237
00:17:59,850 --> 00:18:02,280
We were logged in as Johnny B.

238
00:18:02,280 --> 00:18:10,980
So I just reopened it and you would expect you know from your normal use of other apps that we would

239
00:18:11,180 --> 00:18:15,350
you know still be logged in and we kind of are.

240
00:18:15,660 --> 00:18:20,610
Because if you see here the Boullion is still set saying that we're logged in but we don't have any

241
00:18:20,610 --> 00:18:23,050
of our user info or anything.

242
00:18:23,070 --> 00:18:24,690
So we need to fix that.

243
00:18:24,690 --> 00:18:30,300
So we're going to do that is here in our chat and we see what we're going to do is when we load up the

244
00:18:30,360 --> 00:18:34,940
app we're going to go ahead and just do a check.

245
00:18:35,130 --> 00:18:40,620
So yes we're going to do a check if we're logged in and if we are then we're going to go ahead and call

246
00:18:40,620 --> 00:18:46,840
that function the find use or by email do our post notification that user data has changed.

247
00:18:46,950 --> 00:18:53,850
And that should get us going in the right direction and we'll see if off service.

248
00:18:54,680 --> 00:18:55,160
Come on.

249
00:18:55,320 --> 00:19:05,080
If the service that instance that is logged in to if we are logged in then we are going to call the

250
00:19:05,080 --> 00:19:10,150
office service for instance dot find use or by email function.

251
00:19:11,070 --> 00:19:12,730
Success.

252
00:19:12,820 --> 00:19:21,340
And so here are we going to do is post the notification saying that we have logged in so user data has

253
00:19:21,340 --> 00:19:22,150
changed.

254
00:19:22,150 --> 00:19:31,750
So notification center dot default dot post and the notification that were posting that were the name

255
00:19:31,750 --> 00:19:41,490
of the broadcast that we are blasting out is no to underscore user data did change object is no case

256
00:19:41,500 --> 00:19:42,820
going to save that.

257
00:19:43,320 --> 00:19:45,030
So this is all hunky dory.

258
00:19:45,070 --> 00:19:47,360
But if we come in to our channel ABC

259
00:19:49,870 --> 00:19:56,600
this this this view might not have been instantiated at the time that that notification is fired off.

260
00:19:56,660 --> 00:20:05,120
So we also need to do is here in our view did appear we need to do a check and set up the user data

261
00:20:05,180 --> 00:20:06,110
accordingly.

262
00:20:06,110 --> 00:20:12,540
So in other words we need to do everything that is being done right here in view did appear.

263
00:20:12,650 --> 00:20:22,040
So let's go ahead and create a function for that sort of this funk set up user info and to just copy

264
00:20:22,620 --> 00:20:24,240
her cut everything out of this.

265
00:20:24,260 --> 00:20:27,340
Usually data to change and put you right here.

266
00:20:27,470 --> 00:20:37,840
And then Im going to call set up user info here and here in view did appear that way if we're opening

267
00:20:37,840 --> 00:20:46,660
up the app from scratch chat we see loads up the end and we have been logged in previously so our token

268
00:20:46,660 --> 00:20:50,980
emails are saved and we're going to find our user information.

269
00:20:50,980 --> 00:20:58,060
And then when we open up channel ABC here on view did appear we're going to do a check here and we're

270
00:20:58,060 --> 00:21:04,840
going to say Oh hey I have everything that I need to set up the user info for a logged in user.

271
00:21:04,900 --> 00:21:05,320
OK.

272
00:21:05,410 --> 00:21:07,640
So let's go in and run that and test it.

273
00:21:08,260 --> 00:21:13,390
And I think we ended with a logged in users so up and there we go all around.

274
00:21:14,230 --> 00:21:22,870
So from a fresh start we we loaded up we got our our user information via that new function that we

275
00:21:22,870 --> 00:21:26,450
created and loaded up all of our eyes accordingly.

276
00:21:26,470 --> 00:21:34,780
So that's pretty exciting and if I log out then it goes back and if I close the app and then re open

277
00:21:34,780 --> 00:21:35,220
it.

278
00:21:35,320 --> 00:21:39,230
All right and I guess I didn't actually close it and see here.

279
00:21:39,430 --> 00:21:47,400
So closing it and then reopening it and everything should be blank.

280
00:21:47,800 --> 00:21:52,720
So then we can log in again at the time.

281
00:21:52,920 --> 00:21:58,330
One two three four five six and boom.

282
00:21:58,330 --> 00:22:01,360
All right so great.

283
00:22:02,080 --> 00:22:04,390
So we have this lesson.

284
00:22:04,390 --> 00:22:11,360
We created a new function so that we could get the users information based off of their e-mail.

285
00:22:11,590 --> 00:22:18,820
And then with that information we were able to set it so that we can log in users from the logging page

286
00:22:18,820 --> 00:22:24,990
instead of having to do the whole create account cycle every single time we wanted to log in.

287
00:22:25,090 --> 00:22:30,370
And then we also set it up to where if you're launching it from scratch and you have already logged

288
00:22:30,370 --> 00:22:33,030
in and in the past you don't have to log in again.

289
00:22:33,040 --> 00:22:34,780
Now it just logs you lugs.

290
00:22:34,840 --> 00:22:36,130
Lugs you in automatically.

291
00:22:36,130 --> 00:22:37,300
So that's really nice.

292
00:22:37,300 --> 00:22:38,980
All right so we're making great progress.

293
00:22:39,190 --> 00:22:45,610
I know you guys are probably itching to start actually working with web sockets and the actual chat

294
00:22:46,720 --> 00:22:49,800
part of this app but sorry about that.

295
00:22:49,810 --> 00:22:57,010
But this has been a lot of lead up to get into it and but I mean we've learned a ton so far and a lot

296
00:22:57,010 --> 00:23:01,240
about web requests using El-Amir fire and working with API and everything.

297
00:23:01,240 --> 00:23:02,780
So yeah I hope you guys are having fun.

298
00:23:02,810 --> 00:23:09,850
And just to finish off here I'm going to add our progress make sure that you are doing the same on your

299
00:23:09,850 --> 00:23:12,990
end and I will see you all in the next one.

