Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Case in front of the court of Lavallade Abdallah.
This is our partner, 24 inside this video, graduate student, Log-in EPA.
If I go back to Ed, in the last video, we had created a register API by the help of this register
method and its API, we had created fewer students inside this student's table.
Now, at this time, by the help of email address and the password will create a login API so that student
can login successfully.
And after login, who will generate a sanctum token after generating s.m token, really able to use
all of the roads inside this group.
Middleville Because all these roads, as you can see here, these are protected and all they are needs
are Sanctum Tolkan, Authenticated, Sanctum, Tolkan.
So let's see all the steps if I back to student controller go inside this logging matter.
So inside this method, first of all, we will do some validation with the requested parameters, like
we will pass email address and the password to log in any student.
So we need some validation or input fields next week to check student that is to exist or not.
After that, we'll create a token.
This is a sanctum token.
After that, we will send our response.
Send a response, so let's see about this violation first, so we will use request, incents, validate
method and inside this repository.
This is e-mail and password.
These are two input files we will take inside this login API.
So the rules are required and we need a valid email format next, with the password only required,
all we had done with the validation go inside is Jack, a student letter that we have passed our email
address and a password now in the next stage for you to check that these credentials, what we have
passed, is correct or not.
So first of all, in the first stage of this check, a student will compile the email address.
What we have passed is accessed in our database or not.
So let's say that student equal to student model and we will use a view method email equals to and Hewlett's
a request and email and we will use first method.
So when we will pass the email address via computing the email address with the database email field,
if it accessed that it will return our Student Jobs Act, otherwise this object will be empty.
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
sees that if we have a valid student email address that it will return that student ID.
So it is said otherwise here will have or else block its return response.
Jaeson, bussing in every little status equals to Setu and message.
It's a student not found.
And also let's pass for the voice to the school board.
Now if I could, these two comment lines go inside this F block based on you two.
Now let's see that email address.
What we have past is available inside our database table.
Now, in the next stage, we need to check the password.
So to copy a password because we will pass the plaintext value inside of a request.
So we will compile the plaintext password with the highest value, what we have inside our database.
So what I will do, we will use the check method of past class in the last video we have imported here,
as we can see.
So go inside login method.
Let's f hash inside it.
We need to use check method.
And inside this chick Methode, look at the Intellisense, the first is the value, it means plaintext
value in the second redoubles highest value.
The first value is coming from request and the second value is the comparing value coming from database.
So the first value something request basswood and next lets a student and password.
In this line, what we have done simply we are comparing this plaintext possible with past value, what
we have inside our database.
So once this email will be verified, if this is to exist in our database, so then we are taking its
password now.
Next, I kinkaid these two lines.
Go inside the safe block, he will have his block copy this response, Cohill pasting it to now.
This time, the masses should be something Basswood didn't match.
So it's a password didn't match.
And finally here inside this if blog, it means that successfully we have verified the email address
and the password, so after successful verification, we need to create a center token.
So how can we create simple it's a token equals to student means this is an instance of a student.
Observe this trend model.
Sorry.
So here will use a method called create token and one more thing before creating any token.
If I backed to database go to.
And as we know that when we had installed the sanctums settings sanctum package, this is the migration
file.
What generated right now inside is personal access tokens.
There's no entry but a little token hearing to specify Abdulghani, let's say Orte underscore token
and here we will use plaintext token we receive successfully.
We have generated a sanctum token Novita next send to the response.
So let's return response Jeanson busing in any Litsa that status equals to one message student logged
in successfully and finally need to pass access token its access token.
And here inside this variable we are generating the token value.
So let's summarize this code one more time.
What we had done simply in the first few lines, we had done the validation of input files.
Next, we had to check this email address access to not what we have passed inside this request.
If this email address existed, then we are checking it's password.
Otherwise, if the email address what we are provided does not exist, then we will get a message.
Something is not found inside this F block.
Now we are thinking it's password.
A password is invalid.
Then in that case, password didn't match otherwise.
Inside this F block we are generating or access token and sending inside this response.
So if I save all these changes back to man, if I copy this round, open a new tab.
So here instead of registerable, it's a login API.
Back to Ed, go inside EPA, dot, BHP.
The request I have we have called the post request I so to select post request type EPA login go to
Hadass Litsa content type application tewson excerpt lytes application Deusen Go to body roll and he'll
read to pass email address and the password.
So email.
If we don't pass any value, also, we have handled our validation, so we are not passing any value,
click on send button.
As we can see, we have validation errors like the email filters required and the password field is
required.
Now, in this case here, we had done the registration in the last video, so I will use the same credentials.
I will copied email address based on you, too.
And as we know that this password, what I typed is incorrect.
So if I click on the send button password didn't match.
And once we typed the invalid email address, which does not exist inside, Auditability will click
on send button the message we have not found.
So let's pass the valid details.
This is the email address and the password is from one to six.
Click on send button.
As we can see, status equals to one student logged in successfully.
And here, as we can see that we are getting our access token value back to database stable personal
access tokens.
Click on Browse and as you can see that we have generated or accessed token with the name of our token.
Here is the token value.
Ability means it will ability to do any operation and heal by the help of student model.
Actually, we have generated back to Postman now here, look at the structure of this sanctum token.
It's it is very, very lightweight in comparison of JWT token as well as passport token.
Then we will see those tokens in upcoming videos.
Then we will compute that this is very lightweight.
So due to very lightweight token structure, it is highly recommended to use in single page applications.
Now, in the next video, guys will work for profile and look out API successfully.
Inside this video, we had seen the login concept and also all about the access token concept so far
this session, gas and formatting and have a great.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.