1
00:00:00,390 --> 00:00:02,940
So we have the basic setup in place.

2
00:00:03,980 --> 00:00:12,140
Now, what I want to do is scroll a little bit down and learn where I create the user instead of send

3
00:00:12,140 --> 00:00:12,740
email.

4
00:00:13,100 --> 00:00:15,530
You want to go would send the verification email.

5
00:00:16,010 --> 00:00:18,710
And now remember, we want to pass in.

6
00:00:19,040 --> 00:00:20,750
Quite a few things were there.

7
00:00:21,260 --> 00:00:21,680
Correct.

8
00:00:22,340 --> 00:00:24,980
So we want to pass in email.

9
00:00:25,980 --> 00:00:30,420
We want to pass in a verification token as well as origin again.

10
00:00:30,870 --> 00:00:33,900
I'll spend an entire video on origin.

11
00:00:34,290 --> 00:00:36,140
And what are your options for now?

12
00:00:36,150 --> 00:00:43,140
I just want to showcase that if we go back to auth controller, what we're looking for is the user,

13
00:00:43,440 --> 00:00:48,960
because pretty much user has all of those of ours, their only one will have to set it up over here

14
00:00:48,960 --> 00:00:52,140
ourselves is going to be that origin.

15
00:00:52,950 --> 00:00:58,740
So let's go here, and let's say that name will be equal to user, not name.

16
00:00:59,490 --> 00:01:06,690
Email is going to be equal to users that email your guess that then verification token will be equal

17
00:01:06,690 --> 00:01:10,170
to user verification token.

18
00:01:10,620 --> 00:01:18,990
And then lastly, we want to set up the origin so where the user will navigate once he or she clicks

19
00:01:18,990 --> 00:01:21,780
on that link and for the time being.

20
00:01:22,140 --> 00:01:24,210
What is the URL where we're working?

21
00:01:24,870 --> 00:01:26,810
It's localhost 3000, correct?

22
00:01:27,150 --> 00:01:29,400
So effectively it is as simple as that.

23
00:01:29,730 --> 00:01:34,610
You just check what is the development URL and you set it up.

24
00:01:34,620 --> 00:01:38,070
So in my case, I got it just because I prefer this way.

25
00:01:38,430 --> 00:01:44,970
I'm just going to go here and I'm going to copy and can do that above the user, below the user.

26
00:01:45,390 --> 00:01:47,790
That is entirely irrelevant.

27
00:01:48,330 --> 00:01:56,520
I'm going to go here with origin and that is equal and set it up a string and just remove the forward's

28
00:01:56,520 --> 00:01:57,000
last year.

29
00:01:57,510 --> 00:02:00,000
Set it up as localhost 3000 again.

30
00:02:00,330 --> 00:02:00,750
Why?

31
00:02:00,750 --> 00:02:06,510
I know that this value is there because that's the URL if you have a different one than, of course,

32
00:02:07,200 --> 00:02:08,310
passed in a different one.

33
00:02:08,789 --> 00:02:15,510
When we set up the origin and before we can send anything, there is one more thing that we need to

34
00:02:15,510 --> 00:02:15,700
do.

35
00:02:15,720 --> 00:02:24,510
We need to go back to a send verification email and now we need to use these values to construct that

36
00:02:24,510 --> 00:02:25,050
URL.

37
00:02:25,650 --> 00:02:34,560
And yes, on frontend here there is a route that actually will match to whatever we're going to set

38
00:02:34,560 --> 00:02:35,220
up right now.

39
00:02:35,850 --> 00:02:41,760
So again, this is what you need to understand, that you have to set this up pretty much synchronously

40
00:02:42,360 --> 00:02:49,350
where on a backend you'll be like, Hey, please confirm your email by clicking on the following link,

41
00:02:49,350 --> 00:02:55,770
but that link will lead to your frontend because that is the only way how pretty much you can set it

42
00:02:55,770 --> 00:02:56,080
up.

43
00:02:56,100 --> 00:03:00,870
I mean, the user cannot just navigate to some magic server link.

44
00:03:01,080 --> 00:03:04,770
So if you're setting up a link, it needs to go to some kind of frontend.

45
00:03:05,070 --> 00:03:07,920
Granted, that frontend might be here.

46
00:03:08,760 --> 00:03:09,960
It might be on the public.

47
00:03:09,960 --> 00:03:17,130
It doesn't have to be a separate application, but regardless it's going to navigate to a frontend somewhere.

48
00:03:17,760 --> 00:03:20,280
And then from that front end, what we're going to do.

49
00:03:21,230 --> 00:03:27,200
Well, remember, we just set up verify email, and again, I'll talk about that functionality in the

50
00:03:27,200 --> 00:03:29,030
following video for now what I want to do.

51
00:03:29,270 --> 00:03:36,290
I want to go back to send verification email and where I have the message above it, I'll construct

52
00:03:36,290 --> 00:03:37,040
that URL.

53
00:03:37,400 --> 00:03:42,020
I'll say Konst, and I'll call this verify email.

54
00:03:42,380 --> 00:03:44,860
And that is going to be equal to my URL.

55
00:03:45,320 --> 00:03:47,550
And here are your template strings.

56
00:03:47,570 --> 00:03:52,010
I'll use the origin and my case local host three thousand and one.

57
00:03:52,040 --> 00:03:55,310
I know that there is already on front frontend.

58
00:03:55,310 --> 00:03:58,310
A root and root is following user.

59
00:03:58,550 --> 00:04:00,160
So for its lush, use their words.

60
00:04:00,950 --> 00:04:03,850
Verify Verify token.

61
00:04:03,870 --> 00:04:07,760
Again, this is already set up on a frontend and normally this is what you have to do.

62
00:04:08,210 --> 00:04:11,020
Then we'll go with a question mark.

63
00:04:11,030 --> 00:04:13,340
So we're passing in the query string.

64
00:04:13,520 --> 00:04:16,970
I'll say token is equal to a verification token.

65
00:04:17,209 --> 00:04:18,649
So let me select it here.

66
00:04:18,680 --> 00:04:22,670
So verification token and email is equal to email.

67
00:04:22,940 --> 00:04:29,810
So now you can kind of already see the frontend will get those values and run the frontend.

68
00:04:30,140 --> 00:04:35,990
We'll send it back here, just like we did with the postman or in this case, the frontend is doing

69
00:04:35,990 --> 00:04:37,010
all the heavy lifting.

70
00:04:37,760 --> 00:04:42,320
And then here let's go with email and password as well.

71
00:04:42,830 --> 00:04:44,270
So that's the URL.

72
00:04:44,780 --> 00:04:50,330
Now what's missing here is a nature of it is the actual link back.

73
00:04:50,690 --> 00:04:55,220
So we go here with link and set it equal to a.

74
00:04:55,610 --> 00:05:02,000
So that's the link element, which set up the graph we have right away or a template string.

75
00:05:02,210 --> 00:05:05,870
And if we don't, and my apologies may actually fix it up.

76
00:05:06,320 --> 00:05:09,620
So whereas the message I didn't have a template string my bad.

77
00:05:10,070 --> 00:05:17,900
So let me set up as a template string when I want to add the quotation marks, I want to access my verified

78
00:05:17,900 --> 00:05:20,080
email and mine.

79
00:05:20,090 --> 00:05:21,980
I want to set up some kind of text there as well.

80
00:05:22,460 --> 00:05:26,330
So I'm placing a link tag inside of the paragraph, correct?

81
00:05:26,540 --> 00:05:31,470
And as far as the value for nature of where we're constructing, we have your origin and all.

82
00:05:32,180 --> 00:05:34,730
And let me just write some kind of gibberish.

83
00:05:35,150 --> 00:05:37,850
I'm going to say verify email.

84
00:05:37,970 --> 00:05:39,170
Let's say it.

85
00:05:39,620 --> 00:05:44,680
That's how our file is going to look like and be with me.

86
00:05:44,720 --> 00:05:48,290
Put this one in a separate line here, just so it's a little bit clear.

87
00:05:48,940 --> 00:05:57,350
And now I want to go back to my frontend and register one more time just so I can see whether everything

88
00:05:57,350 --> 00:05:57,770
works.

89
00:05:58,280 --> 00:06:01,280
So let's navigate to a local host.

90
00:06:01,280 --> 00:06:02,030
Three thousand.

91
00:06:03,000 --> 00:06:08,400
We're going to start by clicking on the register again, my database just empty, and I suggest you

92
00:06:08,400 --> 00:06:09,000
do the same.

93
00:06:09,650 --> 00:06:10,620
Just going to be easier.

94
00:06:10,860 --> 00:06:15,780
Instead of guessing which you use there, you haven't created yet, we go with email.

95
00:06:16,150 --> 00:06:18,880
And then let's go with password now.

96
00:06:18,900 --> 00:06:19,830
Let's click.

97
00:06:20,670 --> 00:06:27,450
Beautiful functionalities taking place, and yep, we have success, please check your email to verify

98
00:06:27,840 --> 00:06:28,680
the account.

99
00:06:28,920 --> 00:06:29,670
Okay, awesome.

100
00:06:30,060 --> 00:06:32,160
Now let's navigate to ethereal.

101
00:06:32,640 --> 00:06:36,960
Let's refresh and we should have email confirmation.

102
00:06:36,960 --> 00:06:37,740
Where's it going?

103
00:06:38,040 --> 00:06:40,320
Well, to our John gmail.com, correct?

104
00:06:40,330 --> 00:06:40,590
Why?

105
00:06:40,620 --> 00:06:43,230
Well, because that's what I used to sign up.

106
00:06:43,440 --> 00:06:44,580
That's how we verify.

107
00:06:44,910 --> 00:06:51,330
And then once we open up the email Walla Hello, John, that's the name, correct?

108
00:06:51,360 --> 00:06:54,090
Please confirm your email by clicking on the following link.

109
00:06:54,660 --> 00:06:56,520
So now what is going to happen?

110
00:06:56,820 --> 00:07:01,110
Well, we will navigate to where we'll navigate here.

111
00:07:01,620 --> 00:07:05,220
Origin What is Origin Logo Host 3000?

112
00:07:05,430 --> 00:07:05,790
Correct?

113
00:07:05,820 --> 00:07:06,180
Why?

114
00:07:06,210 --> 00:07:08,130
Well, because that's how I set it up over here.

115
00:07:08,550 --> 00:07:12,510
Now, once we navigate a there, once we get there.

116
00:07:13,370 --> 00:07:18,830
We are looking for user verified token of this without needs to be present on frontend.

117
00:07:18,950 --> 00:07:23,720
We are not magically creating here on a server I already created on a frontend.

118
00:07:24,050 --> 00:07:30,680
So that's why I'm saying you'll work synchronously, you'll set up the backend, but you'll also have

119
00:07:30,680 --> 00:07:34,520
to set up at the same time the front that in order for this to work.

120
00:07:34,970 --> 00:07:36,290
Otherwise, it's not going to work.

121
00:07:36,650 --> 00:07:43,130
And then I'm passing in two things I'm passing in the token, as well as the email using the query string

122
00:07:43,130 --> 00:07:49,280
parameter and next video, I'll cover a little bit more in detail how the setup works in the frontend.

123
00:07:49,630 --> 00:07:55,670
For now, what I simply want you to do is click on this, and for some reason, it's going to complain

124
00:07:55,670 --> 00:07:58,490
that there is no such page.

125
00:07:59,270 --> 00:08:03,860
And most likely, it's because I've made some dumb typo or something along those lines.

126
00:08:03,860 --> 00:08:06,110
So let me double check on my front.

127
00:08:06,110 --> 00:08:09,410
And yep, there out is verify email.

128
00:08:09,950 --> 00:08:11,360
My deepest apologies.

129
00:08:11,840 --> 00:08:12,980
Let me go back over here.

130
00:08:12,990 --> 00:08:17,500
It's not verified token is verify email.

131
00:08:17,840 --> 00:08:19,880
So now let's try that one more time.

132
00:08:20,360 --> 00:08:22,580
Let's go back home or register.

133
00:08:22,970 --> 00:08:26,660
And since I already registered John, I'll have to register your.

134
00:08:27,820 --> 00:08:31,060
So let's go here with Peter at gmail.com.

135
00:08:32,320 --> 00:08:40,570
And password now let's register again, we should get the email, and we do.

136
00:08:41,570 --> 00:08:43,309
So let me take a look.

137
00:08:43,730 --> 00:08:45,050
Those are my messages.

138
00:08:45,500 --> 00:08:52,570
And now we have one for Peter, so you can clearly see that it is working and that if we click on Verify

139
00:08:52,580 --> 00:08:56,420
e-mail now, we finally should navigate here.

140
00:08:57,110 --> 00:09:01,100
And again, behind the scenes, what happens once we hit this throughout?

141
00:09:01,550 --> 00:09:08,840
And I'll show you in the next video the functionality in a frontend, but we grab these values and we

142
00:09:08,840 --> 00:09:11,240
communicate with that verify email.

143
00:09:11,660 --> 00:09:17,750
Remember one of the controls we just set up, and once we do that, we can successfully go back to a

144
00:09:17,750 --> 00:09:18,200
logging.

145
00:09:18,830 --> 00:09:27,170
I say Peter here at gmail.com, I provide the password and I should see here a little bit later.

146
00:09:27,200 --> 00:09:27,590
Why?

147
00:09:27,620 --> 00:09:30,290
Well, because we already have to show me route, correct.

148
00:09:30,350 --> 00:09:34,250
So the moment we verify the user, we are good to go.

149
00:09:34,790 --> 00:09:39,410
And in here, the show me is correct because that is sitting in the cookie.

150
00:09:39,800 --> 00:09:41,480
Hopefully, this wasn't too much.

151
00:09:41,510 --> 00:09:47,000
Hopefully, my mistake didn't throw you off, and now we can move on to the next step.

