User Login, Access Token, & State Management with Vuex and Laravel

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 59

  • @ashisharyal64
    @ashisharyal64 4 года назад +3

    Bro, im doing nativescript-vue app with vuex and axios and this video was exactly what was looking form. THANK YOU!!

  • @7skies246
    @7skies246 4 года назад +4

    Very thoroughly and efficiently explained, This series is gonna save some lives!

  • @DeathEatsCurry
    @DeathEatsCurry 3 года назад +1

    It's nice to see a Vue/Laravel guide that goes into why you do things, not just how.

  • @elvisasante3745
    @elvisasante3745 4 года назад

    Scrypster you just earned yourself a viewer here. That was a short and smooth tutorial. Just what I was looking for. Thanks a lot and I'm looking forward for more tutorials

  • @ericlim8270
    @ericlim8270 4 года назад +1

    You are a real life saver. Hope you are going to make more videos.

  • @dev_jeongdaeri
    @dev_jeongdaeri 4 года назад +4

    This is what I was exactly looking for !

  • @dulerong5
    @dulerong5 4 года назад +1

    Just want to express my thanks for uploading this video.
    @ 6:10, for some reason I cannot access user state from vuex store, using the method being shown here, which uses the following.
    computed: { user: { get() { return this.$store.state.currentUser.user }} }
    I kept getting error, basically the browser telling me that no currentUser is not defined.
    Solution that helped me:
    I used mapGetters, which helps to make vuex state available in any component that you want.
    Below is what I did.
    In currentUser.js
    const getters = {
    user: state => state.user }
    In loginForm.vue
    import { mapGetters } from 'vuex';
    export default {
    computed: mapGetters(['user']),
    }
    This is how I learned vuex, not saying it is better, but it works and I can understand it much easier

    • @dulerong5
      @dulerong5 4 года назад

      As well at 15:20, I had to use mapActions, for some reason mapActions just worked but the method shown did not.
      What I did:
      import { mapActions } from 'vuex';
      export default {
      data(){ return{ user: {email: '', password: ''} } },
      methods: {
      ...mapActions(['loginUser']),
      login() { this.loginUser(this.user)}
      }
      }

  • @Ribby00
    @Ribby00 4 года назад +2

    This is exactly what I'm trying to accomplish. Perfect!

  • @mk.bunchongwanit6550
    @mk.bunchongwanit6550 4 года назад +2

    seems like video is skipped on 19:45 right ?

  • @simplelife3105
    @simplelife3105 4 года назад

    Thanks for such a nice tutorial which I was looking for long. Please extend this tutorial covering crud, advanced data table, permission, roles, activity log. Thanks again.

  • @josephsmithalvaradoechavar3451
    @josephsmithalvaradoechavar3451 4 года назад

    Tu vídeo me fue de mucha ayuda, muchas gracias, eres el mejor. Saludos desde Perú.

  • @lara97196516
    @lara97196516 4 года назад +1

    How do I validate if the username or password is incorrect? How do I pass a variable from the currentUser.js file to the LoginComponent to show the errors?

  • @itdigger-backenddeveloper8942
    @itdigger-backenddeveloper8942 3 года назад

    thank you for your course. One more lesson is required. How to switch between menu items. We must use vue-router or laravel routing will solve that problem?

  • @jigumany
    @jigumany 3 года назад

    awesome tutorial just a learned a lot in a short video

  • @hamzaessakhi2401
    @hamzaessakhi2401 3 года назад +1

    Nice Explanation Thanks a lot.

  • @awaisweis6605
    @awaisweis6605 4 года назад

    i was looking if you can give some information about refreshing the personal access token. or if the access token is expired how to keep the user logged in without showing him the login page every time when the access token expires

  • @dekebaoe
    @dekebaoe 4 года назад +2

    Great job! Thanks a lot.
    Can you zoom the editor and browser... The resolution of your videos are really hard on mobile phone...
    You have lots of unused space if you record your videos.
    Thank you

    • @scrypster
      @scrypster  4 года назад

      Thank you! ❤️ This is an older video but I have since zoomed in on all my newer content. It’s been a learning experience.

    • @munandisichali605
      @munandisichali605 3 года назад

      @@scrypster wanted to see those ones cause your videos are great but now the font size was a burden

  • @MoawiaAlmardoud
    @MoawiaAlmardoud 4 года назад

    Is it safe to store the token in the local storage?
    Can't you just check if it exists?
    Also, if the API has sanctum guard, you can return 401 error if no token

  • @AddMotionLeb
    @AddMotionLeb 4 года назад +1

    Thank you. Great Video.

  • @marekmikusek1684
    @marekmikusek1684 4 года назад +1

    Hi, is it possible to put code in github, it's much easier to debug and understand

  • @huggi2
    @huggi2 4 года назад

    This is very good video, but can you please show us how to do error handling from current user -> loginForm component. If a user gets a error from axios how do we handle it?

  • @philippechavatte8741
    @philippechavatte8741 4 года назад +1

    Good explanation !

  • @charlestwhyte
    @charlestwhyte 4 года назад

    I receive a error in the console log When I use AXIOS to post to the API:
    axios.post("/api/v1/user/login", {
    email: user.email,
    password: user.password
    })
    Is this sentence correct ?

  • @khoroshoigra8388
    @khoroshoigra8388 4 года назад

    Hi, I would like to ask if, is it safe to use localstorage for saving an access token??

    • @khoroshoigra8388
      @khoroshoigra8388 3 года назад +1

      @@ezzabdelhakim7495 if both backend and frontend are separated, I think it is the only way enough to use local storage just to maintain the frontend open as logged user. Combined with the strategy of validating and malform the token before it should save.
      or use refresh token every 1 min, to change the save token

  • @jamols09
    @jamols09 4 года назад

    How did you post to the url without typing then full url of website?

  • @donpuerto
    @donpuerto 4 года назад +1

    This is nice, explain really well. Do we have github link for the project?

  • @izzatnajmi4259
    @izzatnajmi4259 4 года назад

    you just save my life. thanks

  • @tiewhoeting6626
    @tiewhoeting6626 3 года назад +1

    is it secure to save the token at local storage?

    • @scrypster
      @scrypster  3 года назад +1

      I think security is relative to your application. If your app is storing recipes for baking cakes, sure I think this is fine. If your app is for trading stocks, you may want to handle this in a different manner. There are a lot of different techniques and and security strategies. It really depends on your application and how many hoops you want to jump through. I think in most cases using cookies or localStorage is acceptable coupled with other best practices like HTTPS.

  • @igorsergio123
    @igorsergio123 4 года назад

    Nicely done

  • @imranlashari6578
    @imranlashari6578 3 года назад

    Thanks. But now we don't need to make a custom login system, as Laravel 8 provides Jetstream with Inertia having login scaffolding.

  • @fahadtanwir6872
    @fahadtanwir6872 3 года назад

    could you please provide the github repo for this tutorial series?

  • @GoogleUser-mx5oe
    @GoogleUser-mx5oe 3 года назад

    So this is like a part 2 of a project cuz you using an alredy created project. So where is par 1 ?

  • @matrat1014
    @matrat1014 4 года назад +1

    Post your login controller please, or share your code in git repository.

  • @joshbarros1995
    @joshbarros1995 3 года назад

    This video is awesome!!! Where can I find the source code?

  • @houiderwalid5842
    @houiderwalid5842 4 года назад

    can we have the source code please, i just want to know how did you create the logout.

  • @jlvargas18
    @jlvargas18 4 года назад

    Anyone know why Auth::user() is null in LoginController?

  • @cesarlinux
    @cesarlinux 4 года назад +1

    Hi, very good video! I've seen some of yours they're understandable and well explainded, good job! can U add the git link to the code please?

  • @philipph9064
    @philipph9064 4 года назад +1

    👍

  • @ltayn
    @ltayn 3 года назад +1

    please have my babyes!

  • @johnrieltaladtad2392
    @johnrieltaladtad2392 2 года назад

    kulang

  • @chimithinley5113
    @chimithinley5113 4 года назад +2

    How do I validate if the username or password is incorrect? How do I pass the error that retrieves from the Usercontroller into currentUser.js to LoginComponent to show the error?

    • @6BEEP9
      @6BEEP9 3 года назад

      .catch() i assume like you would if you did the axios calls on component