Тёмный

Laravel Vue SPA Issue Tracker part 2: passport api auth 

Programming with Peter
Подписаться 1,6 тыс.
Просмотров 5 тыс.
50% 1

Опубликовано:

 

27 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 73   
@ProgrammingwithPeter
@ProgrammingwithPeter 5 лет назад
Guys because I want you to get started easier with php artisan serve, instead of sending the request with guzzle, I did it the "laravel way" at the end.
@metalevel7739
@metalevel7739 4 года назад
cannot thank you enough for making this. I was beating my head against the wall trying to get through the laravel documentation and you helped me out 1000000 million. Thank you!
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
Yea, because the documentation has every case for passport inside the same page looks pretty confusing.
@janbrianpaulebora8438
@janbrianpaulebora8438 4 года назад
Hey Bro! Thank you for this. I fixed my OAuth2 configuration on SPA hosted on Heroku. You deserve more subscriber and thumbs up because not everyone are willing to share their knowledge for free. More power!
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
Glad that I could help you! There are more people like me, some are shy tho, so they prefer to not make videos!
@Kirasim25
@Kirasim25 2 года назад
is it possible to make a core server for authentication purposes that can be used by other clients I mean SSO
@ProgrammingwithPeter
@ProgrammingwithPeter 2 года назад
Yes it is, but it's far more complex and you have to make the API really really well because third party will have to integrate with it. Example: Keycloak
@Kirasim25
@Kirasim25 2 года назад
Okay thank you for your answer, you really are good when explaining things if you have time please make some video on this it will help most of us
@abelenocrodriguez
@abelenocrodriguez 4 года назад
Great job Peter, it would be nice if you made a video with user roles Laravel + Passport + Vue + Vuex
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
Thanks! We have a video on roles and we can use the store too, someone else asked not to use the store,but we can make a video to show you, how it would be. When you get to the latest videos, tell me if you still want that.
@abelenocrodriguez
@abelenocrodriguez 4 года назад
@@ProgrammingwithPeter Ah well, thank you very much I will review it and I will let you know in a comment in that video, good work brother!
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
@@abelenocrodriguez if you don't get what you want, we can use vuex too, half of the work is done already.
@abelenocrodriguez
@abelenocrodriguez 4 года назад
@@ProgrammingwithPeter It is more than anything not to harm the concurrence of data in larger environments
@faruksaldr7338
@faruksaldr7338 3 года назад
Hi Peter. How to make multi auth guard api with laravel passport. Like Admin and Customers api.
@ProgrammingwithPeter
@ProgrammingwithPeter 3 года назад
We did something later on the series but you will still need to put there your own logic. Thanks for watching.
@murilolivorato1489
@murilolivorato1489 4 года назад
Thanks
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
Thank you too!
@endrosamstrong1332
@endrosamstrong1332 4 года назад
Hey bro, why i typing this code " $tokenRequest = Request::create(uri:'/oauth/token', method:'post', $data); " got error underline. whats wrong
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
Hello, there is no uri: or method: on my code, that is just some helper from the editor to tell me what it means, so remove them.
@endrosamstrong1332
@endrosamstrong1332 4 года назад
@@ProgrammingwithPeter yes bro, typing uri: and method: got error
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
Glad that you fixed it
@endrosamstrong1332
@endrosamstrong1332 4 года назад
@@ProgrammingwithPeter How fixed it bro. using guzzle so long response
@hendarmsa716
@hendarmsa716 4 года назад
Hello peter, I get an error called "invalid_grant" with 400 response (bad request). It said that provided authorization grant or refresh token was invalid, expired, revoked, didn't match the redirection URI, or was issued to another client. What should i do? Thanks
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
I think that you regenerated your DB clients while being logged in on the application? Did you finish the video? When do you get the error? I need some more context.
@hendarmsa716
@hendarmsa716 4 года назад
@@ProgrammingwithPeter thanks for your fast respond, peter. I have finished your video till 3rd episodes, it's awesome to follow the next episodes. So, the issue happens when i send correct user (in my app, i have changed default email with another username to logged in) and password via clicking login buttons. I followed your code to send token request, and when i use var_dump to see the token request content, it get same value.
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
So you are saying that everything is correct? What do you mean by "I have changed default email with another username"?
@hendarmsa716
@hendarmsa716 4 года назад
@@ProgrammingwithPeter yep, i think everything i correct according to your step. As your mention, the default laravel passport auth using email and password to authenticate users, i changed email to other value for example identification number, etc. Back to the problem, is the league/oauth2 vendor problems?
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
So for you even with "email" is not working? I'm trying to find some resources for you to make it work with something else, but before that, I need to know if you made it work with "email" as the key of passport auth.
@murilolivorato1489
@murilolivorato1489 4 года назад
very good my friend
@matteoraf
@matteoraf 4 года назад
Hi Peter, did you plan to implement a logout feature too? Could this be a good way to log a user out? axios.delete('/oauth/personal-access-tokens/' + tokenId);
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
I totally left out the token deletion part because it's right on the docs as far as I remember, we can do it if needed. As for your line of code, you don't need to send the token, you already have it on bearer, you can find the user and get the token and either remove one token or all of users token(logout on all devices practically, here is more involed, but hope that you get the idea). Also, you don't get the tokenId anyway.
@matteoraf
@matteoraf 4 года назад
Programming with Peter thank you! I wasn’t aware of the revoke() method as it was not on the official doc. I just found it searching on github.
@newprogrammer1811
@newprogrammer1811 4 года назад
why did you not use php artisan command to create a controller?
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
Can't remember what I did, but I use the make:controller command only if I want a resource one because it generates more, otherwise if I just need a simple one and have another that is pretty much the same, copy paste seems faster. On this episode tho, I might have copied the controllers that are generated by laravel for auth.
@miv.1496
@miv.1496 4 года назад
Hi, lost a bit, explain the transition from localhost:8000 to localhost:8004.
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
It is something that I had, I got a crash on the terminals but the process existed already and I didn't bother closing.
@miv.1496
@miv.1496 4 года назад
@@ProgrammingwithPeter Thanks for your prompt feedback.-
@shawonhossain519
@shawonhossain519 4 года назад
How can i implement multiple authentication using passport ??
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
What do you mean by multiple authentication?
@shawonhossain519
@shawonhossain519 4 года назад
@@ProgrammingwithPeter there will be multiple type of users...but for now i want just another one. 1. admin user (who manages admin panel) 2. frontend user (visitors/customers) For frontend authentication i want another user model named customers.....there will be another login & registration form. I also want the service as token based authentication system which you have implemented in previous videos using passport
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
@@shawonhossain519 Well it shouldn't be too different, you just need to implement the security yourself, the auth logic can be reused you just need to add and check the roles, if the current user is not admin, give him forbidden errors. That's the idea behind it.
@ezoudj.7952
@ezoudj.7952 4 года назад
Hii in postman i have this error { "error": "invalid_grant", "error_description": "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.", "hint": "", "message": "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client." } thanks for your help
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
Can you check the database, maybe you didn't do the php artisan passport:install and you don't have any clients on passport? I think someone else had the same issue, unfortunately i can't check it right now, so if it's ok on sunday, give me a headsup to remember to check it out! Thanks for watching
@杨鸢
@杨鸢 5 лет назад
Why did I get an error: SQLSTATE[HY000] [2002] Connection refused (SQL: select count(*) as aggregate from `users`,when I tested localhost:8080/api/register,I confirm that my database connection is normal.
@ProgrammingwithPeter
@ProgrammingwithPeter 5 лет назад
It's hard to guess, it is something about your DB credentials, check .env, check if you can login with those credentials from another application or from terminal, check config/database.php and see if everything is in place, maybe you have a config cache so try a php artisan cache:clear
@ProgrammingwithPeter
@ProgrammingwithPeter 5 лет назад
Some people have issues when using DB_HOST=localhost or 127.0.0.1
@杨鸢
@杨鸢 5 лет назад
@@ProgrammingwithPeter Thank you for your reply, but it doesn't work,maybe it’s my problem with my Docker,Thanks again.
@ProgrammingwithPeter
@ProgrammingwithPeter 5 лет назад
Well, yes, why you didn't say that you have docker.. It would have been the first on my list!
@ProgrammingwithPeter
@ProgrammingwithPeter 5 лет назад
Instead of using the default port, try to use the docker port that you have on the mysql image
@kmata53
@kmata53 5 лет назад
Did Peter commit today's work? Yes.
@ProgrammingwithPeter
@ProgrammingwithPeter 5 лет назад
Told you that I would commit on the next one :)
@hilmihidayat
@hilmihidayat 4 года назад
hello peter, can i get the project folder in this step ?
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
Hey, I will open github repositories with the projects folder on the next episode(in a few days), can't do it right now. But why do you need the source for the ep2 ? Do you have any issues ?
@hilmihidayat
@hilmihidayat 4 года назад
@@ProgrammingwithPeter yes Peter, I can't from the 22nd minute. There is an error "Symfony \ Component \ Debug \ Exception \ FatalThrowableError: syntax error, unexpected ':', expecting ')' in file C: \ xampp \ htdocs \ issue-tracker-backend \ app \ Http \ Controllers \ Api \ AuthController.php on line 28 "
@hilmihidayat
@hilmihidayat 4 года назад
btw line 28 on AuthController is "return response()->json(["success" => false, "message" => 'Registration failed'], status: 500);"
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
search the file for : it's justa syntax error for you
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
ohh I see the error, that "status:" it's not something that I put there, it should be removed. My editor it's saying that the second param is a status for that method, it's not actually on text, just visually there.
@The606P
@The606P 4 года назад
Passport::routes(function ($router) { $router->forAccessTokens(); }); enough for this project ) don't stop it ))
@ProgrammingwithPeter
@ProgrammingwithPeter 4 года назад
Yea, we could use that to register only the routes needed for us! Don't remember what I did on the video, tho! Thanks.
@creativeedge3569
@creativeedge3569 5 лет назад
Looks like not inspired to this tutorial by saying "Damn it, it's hard to speak" peace!
@ProgrammingwithPeter
@ProgrammingwithPeter 5 лет назад
Hello, did you mean "interested" instead of "inspired" ? Because it's really hard to understand what you meant...The reason for why I said that, it's because it is really hard for a non native to talk correctly, explain things well, code and filming at the same time, I still didn't get used to this, but for sure I got better! Thanks for checking it out, even if it's not ok for you!
Далее
Laravel Vue SPA Issue Tracker part3: vuetify setup
38:59
Random Emoji Beatbox Challenge #beatbox #tiktok
00:47
На самом деле, все не просто 😂
00:45
Don't Use Websockets (Until You Try This…)
6:46
Просмотров 316 тыс.
Fetching Data Doesn't Get Better Than This
6:58
Просмотров 128 тыс.