If you want to authenticate using Laravel Sanctum you can check these tutorials: React and Laravel JWT Authentication: ruclips.net/p/PLlameCF3cMEuSQb-UCPDcUV_re5uXaOU9 VueJS and Laravel JWT Authentication: ruclips.net/p/PLlameCF3cMEs7ErSWENv03zOKtH5NTG61 Angular and Laravel JWT Authentication: ruclips.net/p/PLlameCF3cMEtVCB8awarHu1NjIyEX0Va9 NextJS and Laravel JWT Authentication: ruclips.net/p/PLlameCF3cMEsbPs3bmm98UP3Ny8tqNs1f NuxtJS and Laravel JWT Authentication: ruclips.net/p/PLlameCF3cMEt0mlfWzGkk9_a5iV_xF-wr Svelte and Laravel JWT Authentication: ruclips.net/p/PLlameCF3cMEssaXOEym93ID7_e6ZDyiGO
yes more tutorials are coming on reactjs, but currently here you can find the react and laravel autherization: ruclips.net/video/F9Xmc3iHc88/видео.html
Hi @scalable Scripts, I want to do a especial in order to register new users on front end but with admin user.. but since this api is public for anyone through postman.. this is not secure for my target right?, what is your suggestion to do that? thanks!
Hi @scalable Scripts, I am stuck on minute: 17:29, I am not getting the same result than you on Postman when I changed the param from 'Request' to 'RegisterRequest' on AuthController.. Also I noticed you have a file more named "../Requests/Register.php" , did you some other changes not visible on the video? please could you help me. thanks
Nice question, the regular auth middle ware uses sessions to store information about the authenticated users but passport stores them in the database. That's why when you install passport there are migrations that need to be run. Basically if you want to build RESTful API's you have to pick Passport since it handles also the JWT token and also it will prevent you from going to technical debt if your app goes bigger. I hope I clarified your question, let me know if you have more.
Hi Could you please explain At 10:54 Why did you use /** @var User $User */ in AuthController login method before the $user->createToken(); Thanks in advanced
Thank you for this amazing course, im stuck at 11:23 .. I don't get token like yours. Codes are same. In my case i get something like: "token": { "name": "app", "abilities": [ "*" ], "tokenable_id": 2, "tokenable_type": "App\\Models\\User", "updated_at": "2020-12-01T13:16:22.000000Z", "created_at": "2020-12-01T13:16:22.000000Z", "id": 25 } How can i retrieve accessToken please help me teacher.
in AuthController's login() method i used response like this 'token' => $token->token instead of 'token' => $token then i get the token but not long as yours. After i tried to get the user, postman said "Unauthorized". I did exactly the same thing as you but still i can't get the user..
@@ScalableScripts Oh ok i got the token but i am still "unauthorized". How should i use this token to authenticate? By the way i don't even know about Sanctum how can i remove that :( I'm so new at Laravel API please forgive me.. Thanks a lot for your quick answer.
in api.php i changed ->middleware('auth:api') to ->middleware('auth:sanctum'); then i authenticated now i will continue with your course thanks again teacherr
If anyone had the same troubles as me. (Probably its because I use Laravel 8) First problem: Can't run "php artisan serve" Make sure you are in your project folder: "cd laravel-api" 2. Problem I had. Route::get('hello', 'HelloController@hello'); Fix for me: Route::get('hello', 'App\Http\Controllers\HelloController@hello'); factory(\App\User::class,10)->create(); I had to replace with: \App\Models\User::factory()->count(10)->create();
Short, simple and very precise. Thank you.
honestly
Can you share the repository?
Very usefull video, thank u for sharing.
Ur channel is awesome me badly looking react js and laravel API authentication
If you want to authenticate using Laravel Sanctum you can check these tutorials:
React and Laravel JWT Authentication: ruclips.net/p/PLlameCF3cMEuSQb-UCPDcUV_re5uXaOU9
VueJS and Laravel JWT Authentication: ruclips.net/p/PLlameCF3cMEs7ErSWENv03zOKtH5NTG61
Angular and Laravel JWT Authentication: ruclips.net/p/PLlameCF3cMEtVCB8awarHu1NjIyEX0Va9
NextJS and Laravel JWT Authentication: ruclips.net/p/PLlameCF3cMEsbPs3bmm98UP3Ny8tqNs1f
NuxtJS and Laravel JWT Authentication: ruclips.net/p/PLlameCF3cMEt0mlfWzGkk9_a5iV_xF-wr
Svelte and Laravel JWT Authentication: ruclips.net/p/PLlameCF3cMEssaXOEym93ID7_e6ZDyiGO
Thank you , so I can migrate JWT to passport without hesitate.
Excellent Work!!!
Excelente explicación haces que sea muy sencillo de comprender, muchas gracias.
Nice video, thank you for sharing
Kindly make series on react js tutorial ur awesome teacher
yes more tutorials are coming on reactjs, but currently here you can find the react and laravel autherization: ruclips.net/video/F9Xmc3iHc88/видео.html
Nice video! Congratutations!! This help me so much.. Great!!
Where did you get the token when you test the 'reset' function in Postman?
Thank you for this great video
your are amazing , please share the repository it will help us
Excellent work! Thank you!
which IDE are you using and thank you for the greatest course !
Thank you :) I'm using PHPStorm
Hi @scalable Scripts, I want to do a especial in order to register new users on front end but with admin user.. but since this api is public for anyone through postman.. this is not secure for my target right?, what is your suggestion to do that? thanks!
Hi @scalable Scripts, I am stuck on minute: 17:29, I am not getting the same result than you on Postman when I changed the param from 'Request' to 'RegisterRequest' on AuthController.. Also I noticed you have a file more named "../Requests/Register.php" , did you some other changes not visible on the video? please could you help me. thanks
You should add another header in postman X-Requested-With: XMLHttpRequest then your problem will be fixed
@@ScalableScripts oh yeah it worked. Jason is generated in Postman now :) thanks so much!!!
So... What are the advantages of using passport instead auth middleware?
Nice question, the regular auth middle ware uses sessions to store information about the authenticated users but passport stores them in the database. That's why when you install passport there are migrations that need to be run. Basically if you want to build RESTful API's you have to pick Passport since it handles also the JWT token and also it will prevent you from going to technical debt if your app goes bigger. I hope I clarified your question, let me know if you have more.
Can we create a refresh token with the access_token mannually??
Please share the code.
Hi
Could you please explain
At 10:54
Why did you use
/** @var User $User */ in AuthController login method before the $user->createToken();
Thanks in advanced
Because my IDE sometimes doesn't know that $user is a type of User so it define that in the comments and it will help the intellisense
Hi, when i'm trying to user login, i get "unauthorized" message...
can you provide the source code or repository?
can u please share me this file repository
why you don't validate the input before send the request ?
Is more secure to do it on the backend since the request can come from different sources like Postman for example.
git repo please ?
Thank you for this amazing course, im stuck at 11:23 .. I don't get token like yours. Codes are same. In my case i get something like:
"token": {
"name": "app",
"abilities": [
"*"
],
"tokenable_id": 2,
"tokenable_type": "App\\Models\\User",
"updated_at": "2020-12-01T13:16:22.000000Z",
"created_at": "2020-12-01T13:16:22.000000Z",
"id": 25
}
How can i retrieve accessToken please help me teacher.
in AuthController's login() method i used response like this
'token' => $token->token
instead of
'token' => $token
then i get the token but not long as yours. After i tried to get the user, postman said "Unauthorized". I did exactly the same thing as you but still i can't get the user..
You are using Laravel Sanctum not Laravel Passport. You should use it like this $token = $user-> createToken('app')->plainTextToken;
@@ScalableScripts Oh ok i got the token but i am still "unauthorized". How should i use this token to authenticate? By the way i don't even know about Sanctum how can i remove that :( I'm so new at Laravel API please forgive me.. Thanks a lot for your quick answer.
in api.php i changed
->middleware('auth:api')
to
->middleware('auth:sanctum');
then i authenticated now i will continue with your course thanks again teacherr
reactjs local host 3000 lool
If anyone had the same troubles as me. (Probably its because I use Laravel 8)
First problem: Can't run "php artisan serve"
Make sure you are in your project folder: "cd laravel-api"
2. Problem I had.
Route::get('hello', 'HelloController@hello');
Fix for me: Route::get('hello', 'App\Http\Controllers\HelloController@hello');
factory(\App\User::class,10)->create();
I had to replace with: \App\Models\User::factory()->count(10)->create();