Тёмный

VueJS JWT Authentication 

Scalable Scripts
Подписаться 35 тыс.
Просмотров 81 тыс.
50% 1

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

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 67   
@ScalableScripts
@ScalableScripts 3 года назад
A bugfix in case you can't logout: In Nav.vue the Logout router-link change it to this: Logout then in the logout function after you await the logout request you can redirect to login.
@jonathancolorado2998
@jonathancolorado2998 2 года назад
const logout = async () => { await fetch('localhost:8000/api/logout', { method: 'POST', headers: {'Content-Type': 'application/json'}, credentials: 'include', }); await store.dispatch('setAuth', false); //Add this line to redirect to login route await router.push('/login'); // It is important to put this line too, because if you don't put it, the NAV component will not recognize that it is no longer authenticated. } It will be good if you update your repository to solve this problem, for future students 👍👍👍👍👍
@1dayleft40
@1dayleft40 2 года назад
@@jonathancolorado2998 so helpful thank you
@mustafasargol5224
@mustafasargol5224 Год назад
I took an Error 500 when I registered. I set up backend. How can I fix this
@RyazantsevNikolay
@RyazantsevNikolay 2 года назад
The common problem of all such tutorials is that they pay too much attention how to insert e.g. a button to the code but explain very little or don't explain at all principles of what we're doing. I assume as far as your auditory needs to know about an auth in Vue they already know basics about HTML and Vue so boring 80% of video can be shortened. Unfortunately I haven't learned how JWT works in Vue at all. What are auth cookies? What is difference with tokens? What about BFF? Router guards? Vuex? Nothing. It's just mechanical example.
@jonathancolorado2998
@jonathancolorado2998 2 года назад
You are a monster!, As we say in Colombia, you did a great job and I learned a lot. Thanks
@SantiGelvezDev-br7gd
@SantiGelvezDev-br7gd 4 месяца назад
You save my job with this tutorial! Thank you!
@christianjakealiser1752
@christianjakealiser1752 3 года назад
i followed all the steps but why in the console didnt show the jwt cookie?
@nearmint8350
@nearmint8350 2 года назад
same! did u solve it?
@bo_68
@bo_68 2 года назад
same, did u solve it
@hamidray2429
@hamidray2429 3 года назад
do you backend for this with how create backend vue.js & Initialize Sequelize?
@llanthimoss
@llanthimoss Год назад
how can we solve the cors failed problem?
@youssefmansour5756
@youssefmansour5756 2 года назад
Thanks for the video! I have a simple question why are we using script language? and when do we use it and when not !?
@masutu7210
@masutu7210 3 года назад
Hi, will every youtube video be available on subscription on your website? And where can we follow what new content you re gonna post on your website?
@ScalableScripts
@ScalableScripts 3 года назад
Every video is available when you subscribe, also nice suggestion I will create a new page where I show what I'm currently working on and what I will work in the future.
@ScalableScripts
@ScalableScripts 3 года назад
I created a new page scalablescripts.com/p/schedule where I describe what I'm working on and what I will be working next :)
@zomiedude
@zomiedude 2 года назад
Great thanks from Poland
@rafysancheztilogica8587
@rafysancheztilogica8587 7 месяцев назад
great ! tks for the code in github !
@mylesdavies9476
@mylesdavies9476 3 года назад
Awesome, thanks 👍
@87ruthless53
@87ruthless53 3 года назад
at 18:36 when I click my submit button I get an 404 error in my console for localhost:8000/api/register how can I fix this issue? where I go to network and then preview there a message in the display area saying "Cannot POST /api/register"
@ScalableScripts
@ScalableScripts 3 года назад
Did you build the backend?
@87ruthless53
@87ruthless53 3 года назад
@@ScalableScripts I have not, I skipped straight to 4:12. I think that might be my issue, I'll give it try with dockers
@ScalableScripts
@ScalableScripts 3 года назад
@@87ruthless53 You can use Docker or you can build one of these backends: VueJS and Laravel JWT Authentication: ru-vid.com/group/PLlameCF3cMEs7ErSWENv03zOKtH5NTG61 VueJS and Django JWT Authentication: ru-vid.com/group/PLlameCF3cMEvj7fV-Szcaz_ve303e4AxX VueJS and NodeJS JWT Authentication: ru-vid.com/group/PLlameCF3cMEsjpIRxfB9Rjici3aMCaQVo VueJS and Golang JWT Authentication: ru-vid.com/group/PLlameCF3cMEvSY8iQ6QBVE8VRK4UiZZ33 VueJS and NestJS JWT Authentication: ru-vid.com/group/PLlameCF3cMEujfD19Si2VNRlFEyDa_ZJb VueJS and Deno JWT Authentication: ru-vid.com/group/PLlameCF3cMEuDSusZHXGeIZ0Axmd74aPc VueJS and C# JWT Authentication: ru-vid.com/group/PLlameCF3cMEti_wQrnx9lqlgpTGN9RcqZ VueJS and Kotlin JWT Authentication: ru-vid.com/group/PLlameCF3cMEvidqRQe5Ew65dbC_zN7__M
@codedjango
@codedjango 3 года назад
First of all thanks for this tutorial...for you are the only RU-vidr who stores jwt token with httponly cookie....I followed your tutorial step-by-step but when I logout, the jwt token doesnt get deleted from the browser (whereas from Postman, if I do a POST request to the 'logout' endpoint, the httponly cookie that contains the jwt token successfully gets deleted) ...but not sure why from the browser the jwt token doesnt get deleted while running the Vuejs app? I tried in both Firefox and chrome...same issue....can you please be able to throw some light on this?
@ScalableScripts
@ScalableScripts 3 года назад
I wrote a comment about the bugfix. In Nav.vue the Logout router-link change it to this: Logout then in the logout function after you await the logout request you can redirect to login.
@codedjango
@codedjango 3 года назад
Amazing...Worked like a charm :) Thank you so much :)
@jozmat2268
@jozmat2268 2 года назад
@@codedjango i put that but not resolve.. =( issue is there...
@bo_68
@bo_68 2 года назад
@@codedjango i have successfully logged in but my chorme browser can't add cookies, i have rechecked my code and same as yours
@mitchspiron9606
@mitchspiron9606 Год назад
Misy tsy mety tsony ranga code nao ah
@anisbedhiafi4531
@anisbedhiafi4531 3 года назад
If you refresh your page your authenticated state will be lost.
@DK-pf2dg
@DK-pf2dg 3 года назад
True, did you found solution for this?
@anisbedhiafi4531
@anisbedhiafi4531 3 года назад
@@DK-pf2dg Yes use localstorage with Vue Store
@jamols09
@jamols09 3 года назад
@@anisbedhiafi4531 but I thought its not good to use localstorage. Now im so confused. Is his method really secure ?(provided that we add localstorage)
@jozmat2268
@jozmat2268 2 года назад
@@jamols09 oly shit!!! this is true!! if you close the navigator and enter again the cookie lose! solution?
@danonektm
@danonektm 3 года назад
Good video but this isn't a secure way to implement JWT authentication. You should show how to implement refresh tokens with JWT on the backend.
@ScalableScripts
@ScalableScripts 3 года назад
I know but I didn't want to make it too complicated :)
@andrewaghoghovwia1948
@andrewaghoghovwia1948 3 года назад
What backend is used here?
@danonektm
@danonektm 3 года назад
@@andrewaghoghovwia1948 Laravel
@danonektm
@danonektm 3 года назад
@@ScalableScripts Maybe a part 2 with refresh token implementation? 😋
@ScalableScripts
@ScalableScripts 3 года назад
@@andrewaghoghovwia1948 Currently the available backends are in Laravel and in Django: VueJS and Laravel JWT Authentication: ru-vid.com/group/PLlameCF3cMEtiBwc_DJqvKpxUC2WbOCKl VueJS and Django JWT Authentication: ru-vid.com/group/PLlameCF3cMEv8Fcp3hA2rMG6sBZEh7VWX The other backends will be in NodeJS, NestJS, Golang, Deno.js and they will be uploaded in the following days
@hasyidanparamananda
@hasyidanparamananda 2 года назад
Can i ask, what is store? is that kind of middleware?
@ScalableScripts
@ScalableScripts 2 года назад
That is used by Vuex to store the state of the app. Check more here: vuex.vuejs.org/guide/#the-simplest-store
@nikihl5459
@nikihl5459 Год назад
Left us hanging :( not a good tuttorial
@themalelibrary5072
@themalelibrary5072 2 года назад
when i use credentials: 'include', for login it gives me the error "Ensure credentialed requests are not sent to CORS resources with origin wildcards"
@TDhanunjay
@TDhanunjay 2 года назад
In Nav.vue --- Logout router-link, i changed to below Logout then in the logout function , added --------await router.push('/Login'); After I clicked on logout button also, i am able to redirect back to login page, But in navbar, still i can see Logout???? Can please tell me, why is this happening
@jonathancolorado2998
@jonathancolorado2998 2 года назад
update your "Logout" function to this one, just add two lines at the end of it const logout = async () => { await fetch('localhost:8000/api/logout', { method: 'POST', headers: {'Content-Type': 'application/json'}, credentials: 'include', }); await store.dispatch('setAuth', false); //Add this line to redirect to login route await router.push('/login'); // It is important to put this line too, because if you don't put it, the NAV component will not recognize that it is no longer authenticated. }
@markdennissanchez1325
@markdennissanchez1325 Год назад
Am I suppose to see the cookie on Application and Network tab? Or only on Network tab? Cuz I'm getting AuthenticationException from laravel sanctum.
@alvingalit4865
@alvingalit4865 2 года назад
Logout doesn't seem to work for me. The cookie still remains. I'm using nodejs for backend and the API route works fine when I test in Postman. I've also changed the router-link for logout to the anchor tag.
@haraldsevensen
@haraldsevensen 3 года назад
When I log out, the cookie does not disappear. Do you have an idea of what could be wrong? Have followed the video from start to finish.
@ScalableScripts
@ScalableScripts 3 года назад
Which backend are you using?
@haraldsevensen
@haraldsevensen 3 года назад
@@ScalableScripts Sending it to Laravel with Docker
@ScalableScripts
@ScalableScripts 3 года назад
You are right it doesn't work, the problem is in Nav.vue the Logout router-link change it to this: Logout it will work but it won't redirect. For some reason it redirects before it removes the cookie so I suggest adding a redirect at the logout function also.
@GoogleUser-mx5oe
@GoogleUser-mx5oe 2 года назад
I can see no function from login that created the cookie which I assume is the token, can you just explain pls?
@CyberNinja600
@CyberNinja600 7 месяцев назад
Can someone tell me why I need docker, and is docker very important here?
@jamols09
@jamols09 3 года назад
Hello what would happen if I refresh or close the browser? will i be logged out ?
@guillermorolandocornejoasc7186
hi, very good but, there is way ti show login form without layout?
@borisdmitriy9463
@borisdmitriy9463 2 года назад
Hello, this is a awesome guide. But I have an issue when setting cookie in browser. for postman it works fine, i am using axios with quasar framwork , I have set withCredential = True in axios boot file also. could you help me with it. thanks
@nazar1ua
@nazar1ua 2 года назад
Hello, 'withCredentials' but not 'withCredential'
@kid_rz
@kid_rz 3 года назад
sir, how to seo friendly using laravel and vue spa app... using vue meta?
@rifkiardiansyah616
@rifkiardiansyah616 3 года назад
imma first
@mehmetaltinsoy525
@mehmetaltinsoy525 2 года назад
Great video. Thanks
@erich2s_0103
@erich2s_0103 2 года назад
that's the tutorial i want!
@TheEmgriffiths
@TheEmgriffiths 2 года назад
Fantastic video, thanks
@manee427
@manee427 2 года назад
amazing
@brandonwarner3716
@brandonwarner3716 3 года назад
Please provide a repo with the code. I keep missing small syntactical mistakes. Same for your other videos. You're the only page that doesn't provide the code.
Далее
NodeJS API Authentication using JWT Tokens
30:40
Просмотров 50 тыс.
TEAM SPIRIT: НОВЫЙ СОСТАВ. SEASON 24-25
01:31
Vue 3 + Firebase Authentication in 10 Minutes
9:06
Просмотров 60 тыс.
NuxtJS JWT Authentication
28:26
Просмотров 32 тыс.
FastAPI JWT Tutorial | How to add User Authentication
20:27
Vuex Crash Course | State Management
1:01:19
Просмотров 399 тыс.
What Is JWT and Why Should You Use JWT
14:53
Просмотров 1,2 млн
Laravel API Authentication using JWT Tokens
35:02
Просмотров 101 тыс.
Django API Authentication using JWT Tokens
37:06
Просмотров 183 тыс.