Laravel API Token Authentication and Model Observers (Ep 23) - Build an Advanced Blog & CMS

  Рет қаралды 31,295

DevMarketer

DevMarketer

Күн бұрын

Пікірлер: 39
@yabreoumar6041
@yabreoumar6041 7 жыл бұрын
You are the Best Teacher
@arnelignacio2157
@arnelignacio2157 6 жыл бұрын
thank you so much for this. i was able to use the observer to update the comment count in the post table every time a new comment was added. i am really learning a lot from you... i hope you will continue doing this tutorial videos.. you are a gift to all of us.
@ridwanajibari4443
@ridwanajibari4443 7 жыл бұрын
subscribed, i need to watch all of your series
@AbhimanyuNaikareWebDeveloper
@AbhimanyuNaikareWebDeveloper 6 жыл бұрын
Would passport be a better alternative to videos 23?
@robbradley1337
@robbradley1337 5 жыл бұрын
Yes.
@Sinrise
@Sinrise 6 жыл бұрын
Using Laravel 5.7, this isn't working when creating a new user. The seeding part works but I get "no default value for api_token" error when saving a new user.
@Sinrise
@Sinrise 6 жыл бұрын
Once again I forgot about php artisan config:cache. After running that, it works.
@artyom_mezin
@artyom_mezin 5 жыл бұрын
@@Sinrise thx! your comment is a key to this problem )
@xanthos733
@xanthos733 7 жыл бұрын
Hey Alex, could you do a video or write down in the description which packages you are using for Atom?
@santoshwankhede5926
@santoshwankhede5926 7 жыл бұрын
Sir I am a great fan of your teaching laravel and always wait for your next o ne video......Very few peoples are like you......Could you make a video on Jwt authentication for api in laravel..
@elyunterim
@elyunterim 7 жыл бұрын
how to make a modal dialog with buefy to delete an item from a data listing in a table? Are we going to learn this on the blog?
@mohamedmamdouh6453
@mohamedmamdouh6453 7 жыл бұрын
Hi what if i have multilevel authentications like [ Users - Admins - Sellers ] etc , How could i manage the tokens and do you have a way to do that with JWY or Passport ? Thanks in Advance :)
@johnjosephflorina4450
@johnjosephflorina4450 6 жыл бұрын
Nice video i like all your video
@advaithaj303
@advaithaj303 7 жыл бұрын
What is the difference between observers and events? We can fire an even when ever we are creating, deleteing, etc or created, deleted, etc by using the dispatchesEvents protected variable inside the model
@JacurtisTutorials
@JacurtisTutorials 7 жыл бұрын
Observers are "lower level". They won't be queued (like normally events would be) and they have DIRECT ACCESS to the model you are working with. Events are good for triggering things to happen like sending an email or a notification, but they arent good for directly manipulating the model, which is what we needed here. While you can trigger events at the "creating" state, the model doesn't wait around for the event and all of its listeners to complete. It simply triggers the event and keeps moving. The observer on the other hand is designed to directly manipulate the model. So it jumps in and runs its process and actually holds up the save() function while it works. So by targeting the "creating" stage, we know that the observer is going to be able to finish its job before the model continues the save process. So each has its own purpose. If i wanted to send a welcome email whenever a new user is added to the database, then creating an event tied to the "created" event would be the smarter way to do it. You wouldn't want to use observers for that task because 1) you want that process to be queued and observers can't be queued, and 2) you don't want the model to continue waiting on the observer to finish sending the email. So emails and notifications are great for events because they don't need direct access to the model (only a copy of it) and they can happen asynchronous of the event's save procedure. Observers are better for directly manipulating the model like we do in this video because we do want to hold up the save procedure until we generate that new api_token and we want it run synchronous to the save procedure. I have a video on using events to send a welcome email whenever a user is "created", if you want to see how you would do that: kzbin.info/www/bejne/j3m6ZoywoqZslac
@ridwanajibari4443
@ridwanajibari4443 7 жыл бұрын
i love how you explain this. thanks.
@christostsangaris4785
@christostsangaris4785 6 жыл бұрын
@@JacurtisTutorials Always on point! Lucky to have you around Alex!
@easyvideott7505
@easyvideott7505 7 жыл бұрын
This one was really great!
@jamesparsons8546
@jamesparsons8546 7 жыл бұрын
Where you are using axios through Laravel, I thought you didnt need api tokens as the request is validated through the auth middleware and session. Is there a reason why this wouldnt be secure?
@siliver01
@siliver01 6 жыл бұрын
How did you create that auth page?
@moneymakr639
@moneymakr639 6 жыл бұрын
@DevMarketer - great video..unfortunatly all I get is unauthortized when I try to to to my API url.
@raymondmichael4987
@raymondmichael4987 7 жыл бұрын
Oooohps!! First to comment,API This will be much fun
@SimionChis
@SimionChis 6 жыл бұрын
For me, random is something like dice. Sometimes you have luck and you hit 6,6,6. If this happened in observer, i think the creating of user will stop and a error will be thrown. Am I right?
@voneatpen6060
@voneatpen6060 7 жыл бұрын
Hi, I have php -m, there is openssl but still when seeding, it says Field 'api_token' doesn't have a defau lt value. what should I do?
@robertomunhoz3399
@robertomunhoz3399 7 жыл бұрын
I have the same problem. But when i put $user->api_token = bin2hex(openssl_random_pseudo_bytes(30)); in store on controller, it´s work. I´m confused now!
@djebirihamza1098
@djebirihamza1098 6 жыл бұрын
thank's for your help but i have a problem when i try to access in a page protect by auth:api with my vuejs function ($http ) it return this error 401 (Unauthorized) i'd like to redirect it to login page if user is a guest thank's a lot
@odunladeoluwaseun7880
@odunladeoluwaseun7880 7 жыл бұрын
Thanks for awesome job u are doing sir. Please i asked a question on your previous laravel series but it has not been answered. (series 33). I love to add anchor tag on my categories so that when people click it, it loads posts under each category. I planned to launch my app by 17th of this month and this is the only functionality that remains
@saidulalam2840
@saidulalam2840 6 жыл бұрын
hi, i am using laravel 5.6. i got a problem with auth:api. show Status Code: 401 Unauthorized. please help me.thanks
@akas_rai
@akas_rai 6 жыл бұрын
I wanted to authenticate api with api_token and I have multiple auth system with different role. The api should only be accessed by admin group and selected role admin. For that I have done as follows in ApiController public function __construct() { $this->middleware('auth:admin'); // for admin authentication $this->middleware('superadmins'); //only superadmins role can access api } API url are all fine but i get error with above two lines. It says {"error":"unauthenticated."} But if i remove those middleware it works fine without authentication Note: I haven't used laratrust, all middleware are created manually
@skell_jams
@skell_jams 7 жыл бұрын
Oh is this still happening
@timothyanderson9583
@timothyanderson9583 5 жыл бұрын
8:50 - If I were drinking milk, it would have squirted out my nose.
@joegoodman4358
@joegoodman4358 4 жыл бұрын
if the token doesn't save with the other data, maybe you forgot to specify that api_token is a fillable attribute in your User.php file
@samerhameed320
@samerhameed320 7 жыл бұрын
Hi Sir, First of all, a great thank for you amazing video that did, it’s really useful. I have a question about a Rest API, I will tell you what I am planning to do I have main application build with Laravel, it’s the main have all the data, and also have clients I want to install small application in their local server also build by laravel, to work locally and no need for internet access. What I am planning to do, is to make the client application talk with main application and fetch all the updated data, and the client application sends some data to the main application. As I know OAuth2 is the best way to make secure channel between two applications, if you have some video you made, and it may help me, please kindly share it with me. Or you may help by some advice. (I already try to do it, but I got some problem and error and I am not sure if I am using the right way to do it)
@arianeburnscodetv235
@arianeburnscodetv235 6 жыл бұрын
THANK YOU
@bloggervista
@bloggervista 7 жыл бұрын
Nice
@水萌-y4h
@水萌-y4h 7 жыл бұрын
sso?
@howtotech3956
@howtotech3956 4 жыл бұрын
he looks like eion musk
@MuhammadAdnan-gx6rd
@MuhammadAdnan-gx6rd 5 жыл бұрын
Hello ?
@robaei_net7199
@robaei_net7199 3 жыл бұрын
You are the Best Teacher
API Call to Ensure Unique URL (Ep 24) - Build an Advanced Blog/CMS
37:11
Securing a Laravel API in 20 minutes with JWTs
20:36
Andrew Schmelyun
Рет қаралды 79 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 42 МЛН
Laravel Passport |  | OAuth 2.0 | Get OAuth Token #5
13:21
Bitfumes
Рет қаралды 42 М.
Laravel 8 REST API With Sanctum Authentication
54:13
Traversy Media
Рет қаралды 552 М.
Laravel 6 Advanced - e1 - Service Container
23:27
Coder's Tape
Рет қаралды 275 М.
Starting the Code! - Building an Advanced Blog/CMS (Episode 7)
28:27
Laravel Token based Restful API tutorial
16:44
Tom Codes
Рет қаралды 90 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН