Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,670 --> 00:00:03,840
Case in front of the court of Lavallade Abdallah.
2
00:00:05,080 --> 00:00:10,830
This is our partner, 24 inside this video, graduate student, Log-in EPA.
3
00:00:11,410 --> 00:00:19,090
If I go back to Ed, in the last video, we had created a register API by the help of this register
4
00:00:19,090 --> 00:00:25,240
method and its API, we had created fewer students inside this student's table.
5
00:00:25,840 --> 00:00:34,570
Now, at this time, by the help of email address and the password will create a login API so that student
6
00:00:34,580 --> 00:00:36,250
can login successfully.
7
00:00:36,430 --> 00:00:45,160
And after login, who will generate a sanctum token after generating s.m token, really able to use
8
00:00:45,310 --> 00:00:47,650
all of the roads inside this group.
9
00:00:47,650 --> 00:00:54,640
Middleville Because all these roads, as you can see here, these are protected and all they are needs
10
00:00:54,760 --> 00:00:58,780
are Sanctum Tolkan, Authenticated, Sanctum, Tolkan.
11
00:00:59,260 --> 00:01:04,510
So let's see all the steps if I back to student controller go inside this logging matter.
12
00:01:04,870 --> 00:01:10,660
So inside this method, first of all, we will do some validation with the requested parameters, like
13
00:01:10,960 --> 00:01:14,680
we will pass email address and the password to log in any student.
14
00:01:14,920 --> 00:01:21,730
So we need some validation or input fields next week to check student that is to exist or not.
15
00:01:22,150 --> 00:01:25,000
After that, we'll create a token.
16
00:01:25,360 --> 00:01:27,580
This is a sanctum token.
17
00:01:29,470 --> 00:01:32,110
After that, we will send our response.
18
00:01:35,110 --> 00:01:45,730
Send a response, so let's see about this violation first, so we will use request, incents, validate
19
00:01:45,730 --> 00:01:49,140
method and inside this repository.
20
00:01:50,260 --> 00:01:53,200
This is e-mail and password.
21
00:01:53,650 --> 00:01:57,990
These are two input files we will take inside this login API.
22
00:01:58,660 --> 00:02:11,160
So the rules are required and we need a valid email format next, with the password only required,
23
00:02:12,160 --> 00:02:19,180
all we had done with the validation go inside is Jack, a student letter that we have passed our email
24
00:02:19,180 --> 00:02:25,840
address and a password now in the next stage for you to check that these credentials, what we have
25
00:02:25,840 --> 00:02:28,310
passed, is correct or not.
26
00:02:28,780 --> 00:02:35,350
So first of all, in the first stage of this check, a student will compile the email address.
27
00:02:35,350 --> 00:02:39,150
What we have passed is accessed in our database or not.
28
00:02:39,640 --> 00:02:52,890
So let's say that student equal to student model and we will use a view method email equals to and Hewlett's
29
00:02:52,930 --> 00:02:59,460
a request and email and we will use first method.
30
00:03:00,970 --> 00:03:07,300
So when we will pass the email address via computing the email address with the database email field,
31
00:03:07,780 --> 00:03:14,960
if it accessed that it will return our Student Jobs Act, otherwise this object will be empty.
32
00:03:15,640 --> 00:03:26,650
So in the next step, what we have to do is if it's that it's a student ID, it means that this block
33
00:03:26,650 --> 00:03:34,330
sees that if we have a valid student email address that it will return that student ID.
34
00:03:34,750 --> 00:03:42,040
So it is said otherwise here will have or else block its return response.
35
00:03:44,650 --> 00:03:54,070
Jaeson, bussing in every little status equals to Setu and message.
36
00:03:54,760 --> 00:03:58,000
It's a student not found.
37
00:04:00,070 --> 00:04:03,680
And also let's pass for the voice to the school board.
38
00:04:04,150 --> 00:04:11,180
Now if I could, these two comment lines go inside this F block based on you two.
39
00:04:12,730 --> 00:04:14,530
Now let's see that email address.
40
00:04:14,540 --> 00:04:18,870
What we have past is available inside our database table.
41
00:04:19,330 --> 00:04:22,480
Now, in the next stage, we need to check the password.
42
00:04:23,170 --> 00:04:29,290
So to copy a password because we will pass the plaintext value inside of a request.
43
00:04:29,560 --> 00:04:35,900
So we will compile the plaintext password with the highest value, what we have inside our database.
44
00:04:36,850 --> 00:04:45,250
So what I will do, we will use the check method of past class in the last video we have imported here,
45
00:04:45,280 --> 00:04:46,330
as we can see.
46
00:04:47,890 --> 00:04:49,510
So go inside login method.
47
00:04:49,990 --> 00:04:54,010
Let's f hash inside it.
48
00:04:54,010 --> 00:04:56,680
We need to use check method.
49
00:04:58,730 --> 00:05:04,760
And inside this chick Methode, look at the Intellisense, the first is the value, it means plaintext
50
00:05:04,760 --> 00:05:08,770
value in the second redoubles highest value.
51
00:05:09,500 --> 00:05:16,120
The first value is coming from request and the second value is the comparing value coming from database.
52
00:05:16,760 --> 00:05:27,320
So the first value something request basswood and next lets a student and password.
53
00:05:29,640 --> 00:05:37,290
In this line, what we have done simply we are comparing this plaintext possible with past value, what
54
00:05:37,290 --> 00:05:38,930
we have inside our database.
55
00:05:40,230 --> 00:05:48,330
So once this email will be verified, if this is to exist in our database, so then we are taking its
56
00:05:48,330 --> 00:05:50,010
password now.
57
00:05:50,020 --> 00:05:53,220
Next, I kinkaid these two lines.
58
00:05:55,380 --> 00:06:05,090
Go inside the safe block, he will have his block copy this response, Cohill pasting it to now.
59
00:06:05,140 --> 00:06:09,450
This time, the masses should be something Basswood didn't match.
60
00:06:09,930 --> 00:06:14,220
So it's a password didn't match.
61
00:06:16,520 --> 00:06:23,480
And finally here inside this if blog, it means that successfully we have verified the email address
62
00:06:23,690 --> 00:06:29,990
and the password, so after successful verification, we need to create a center token.
63
00:06:30,230 --> 00:06:38,000
So how can we create simple it's a token equals to student means this is an instance of a student.
64
00:06:38,000 --> 00:06:39,290
Observe this trend model.
65
00:06:39,330 --> 00:06:39,730
Sorry.
66
00:06:40,160 --> 00:06:47,870
So here will use a method called create token and one more thing before creating any token.
67
00:06:48,110 --> 00:06:50,630
If I backed to database go to.
68
00:06:51,530 --> 00:06:57,800
And as we know that when we had installed the sanctums settings sanctum package, this is the migration
69
00:06:57,800 --> 00:06:58,180
file.
70
00:06:58,430 --> 00:07:02,560
What generated right now inside is personal access tokens.
71
00:07:02,750 --> 00:07:12,710
There's no entry but a little token hearing to specify Abdulghani, let's say Orte underscore token
72
00:07:13,580 --> 00:07:20,120
and here we will use plaintext token we receive successfully.
73
00:07:20,120 --> 00:07:25,340
We have generated a sanctum token Novita next send to the response.
74
00:07:25,340 --> 00:07:42,170
So let's return response Jeanson busing in any Litsa that status equals to one message student logged
75
00:07:42,170 --> 00:07:49,790
in successfully and finally need to pass access token its access token.
76
00:07:50,780 --> 00:07:55,700
And here inside this variable we are generating the token value.
77
00:07:56,660 --> 00:07:59,320
So let's summarize this code one more time.
78
00:07:59,660 --> 00:08:06,230
What we had done simply in the first few lines, we had done the validation of input files.
79
00:08:06,650 --> 00:08:13,460
Next, we had to check this email address access to not what we have passed inside this request.
80
00:08:13,940 --> 00:08:18,290
If this email address existed, then we are checking it's password.
81
00:08:18,860 --> 00:08:25,220
Otherwise, if the email address what we are provided does not exist, then we will get a message.
82
00:08:25,220 --> 00:08:29,550
Something is not found inside this F block.
83
00:08:29,810 --> 00:08:31,370
Now we are thinking it's password.
84
00:08:31,730 --> 00:08:33,320
A password is invalid.
85
00:08:33,710 --> 00:08:37,670
Then in that case, password didn't match otherwise.
86
00:08:37,910 --> 00:08:44,390
Inside this F block we are generating or access token and sending inside this response.
87
00:08:45,190 --> 00:08:51,450
So if I save all these changes back to man, if I copy this round, open a new tab.
88
00:08:51,980 --> 00:08:55,040
So here instead of registerable, it's a login API.
89
00:08:55,700 --> 00:08:59,090
Back to Ed, go inside EPA, dot, BHP.
90
00:08:59,360 --> 00:09:06,560
The request I have we have called the post request I so to select post request type EPA login go to
91
00:09:06,560 --> 00:09:21,110
Hadass Litsa content type application tewson excerpt lytes application Deusen Go to body roll and he'll
92
00:09:21,350 --> 00:09:24,560
read to pass email address and the password.
93
00:09:24,570 --> 00:09:25,700
So email.
94
00:09:28,430 --> 00:09:36,800
If we don't pass any value, also, we have handled our validation, so we are not passing any value,
95
00:09:36,810 --> 00:09:38,090
click on send button.
96
00:09:38,750 --> 00:09:43,760
As we can see, we have validation errors like the email filters required and the password field is
97
00:09:43,760 --> 00:09:44,510
required.
98
00:09:45,020 --> 00:09:51,470
Now, in this case here, we had done the registration in the last video, so I will use the same credentials.
99
00:09:51,770 --> 00:09:54,470
I will copied email address based on you, too.
100
00:09:54,740 --> 00:09:59,000
And as we know that this password, what I typed is incorrect.
101
00:09:59,420 --> 00:10:03,290
So if I click on the send button password didn't match.
102
00:10:03,650 --> 00:10:09,980
And once we typed the invalid email address, which does not exist inside, Auditability will click
103
00:10:09,980 --> 00:10:14,300
on send button the message we have not found.
104
00:10:15,650 --> 00:10:18,160
So let's pass the valid details.
105
00:10:18,590 --> 00:10:22,220
This is the email address and the password is from one to six.
106
00:10:22,850 --> 00:10:24,140
Click on send button.
107
00:10:24,770 --> 00:10:29,030
As we can see, status equals to one student logged in successfully.
108
00:10:29,360 --> 00:10:37,280
And here, as we can see that we are getting our access token value back to database stable personal
109
00:10:37,280 --> 00:10:38,180
access tokens.
110
00:10:38,360 --> 00:10:46,640
Click on Browse and as you can see that we have generated or accessed token with the name of our token.
111
00:10:46,910 --> 00:10:48,470
Here is the token value.
112
00:10:49,190 --> 00:10:56,080
Ability means it will ability to do any operation and heal by the help of student model.
113
00:10:56,240 --> 00:11:04,010
Actually, we have generated back to Postman now here, look at the structure of this sanctum token.
114
00:11:04,670 --> 00:11:11,780
It's it is very, very lightweight in comparison of JWT token as well as passport token.
115
00:11:12,320 --> 00:11:15,260
Then we will see those tokens in upcoming videos.
116
00:11:15,500 --> 00:11:18,710
Then we will compute that this is very lightweight.
117
00:11:19,220 --> 00:11:27,260
So due to very lightweight token structure, it is highly recommended to use in single page applications.
118
00:11:28,130 --> 00:11:33,590
Now, in the next video, guys will work for profile and look out API successfully.
119
00:11:33,590 --> 00:11:40,670
Inside this video, we had seen the login concept and also all about the access token concept so far
120
00:11:40,670 --> 00:11:43,480
this session, gas and formatting and have a great.
12553
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.