Nuxt Authentication with Laravel Sanctum

Поделиться
HTML-код
  • Опубликовано: 19 окт 2024
  • Want more? Explore the library at codecourse.com
    A quickstart guide to authenticating in Nuxt with a Laravel API using Sanctum. We’ll use the latest version of nuxt/auth, which includes native support for Sanctum as a provider.
    Official site
    www.codecourse...
    Twitter
    / teamcodecourse

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

  • @SandmanGeek
    @SandmanGeek 3 года назад +6

    Nicely explained Alex.
    A video on Laravel Sanctum with GraphQL would be a great help as there are not many tutorials/guides, specifically with GraphQL.

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

    best and easy tutorial for Laravel Sanctum with Nuxt Auth. Salute Sir. easiest explanation.

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

    thank you very much Alex! i finally got the 'stateful' meaning and get it working properly!!!

  • @MuhammadKhalilZarpio
    @MuhammadKhalilZarpio 3 года назад +5

    Please make a video on nuxt auth configuration with Laravel passport, reading everywhere since yesterday but not in luck. Thank you 💕

  • @xLastxTemplarx
    @xLastxTemplarx 3 года назад +2

    Regarding what you said at 7:42 , you still need to add an index.js file inside the store folder, otherwise vuex will not work and you will need to refresh your page after logging in for example in order to see the changes.

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

      Thank you missed this step. No wonder why login was not working.

  • @rodrigoalejandrobravopina3624
    @rodrigoalejandrobravopina3624 Год назад

    THX BRO STILL WORKING

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

    Thank you for this tutorial!

  • @JesusGil90
    @JesusGil90 Год назад

    It would be great if you can continue with Two Factor Authentication 😁

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

    had no choice but to subscribe...great video..short and useful

  • @gurmukhsingh-uh5qo
    @gurmukhsingh-uh5qo 2 года назад

    thank you for this video, was facing an issue with env var

  • @ColorFR
    @ColorFR 3 года назад +2

    i have this issue: '...CSRF token mismatch..." any idea? i pasted 1 day on this problem

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

    You're a GEM

  • @josuebarros-desenvolvedorw2490
    @josuebarros-desenvolvedorw2490 3 года назад +1

    how can I do a mult-auth???
    different authentication for /admin and another for /user???
    2 separate dashboards, manipulating 2 separate user types (not role)

  • @RamuRamu-eu2sx
    @RamuRamu-eu2sx 3 года назад +2

    You did good tutorial on nuxt.js but registration and Login things makes us so difficult to understand can you add registration part on this

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

    Awesome and helpfull

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

    Thanks a lot !

  • @jonice4229
    @jonice4229 2 года назад +1

    can you make a tutorial how to deploy this?

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

    Why didn't you get the CORS issue when you requested /login endpoint even if you did not exclude that endpoint in config/cors.php ?

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

    great videos

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

    Hi Alex hope you are doing great. I'm having an issue deploying the Nuxt js + Laravel application.
    I have 2 index files ... of course I can't have them both ... The nuxtjs makes a index.html with all the app and the Laravel makes a index.php. So the issue is that if I left the nuxtjs one ... I can't access to Laravel Telescope/Horizon, and if I remove the index.html I can't access the Front-end I made with Nuxtjs.
    Any ideas - videos - recommendations about it ?
    Thanks in advance for your time !

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

    Hey please on deployment, what would be the SESSION_DOMAIN

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

    Nice! Any idea how I can add Google signin to work with this setup?

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

    how to solve error with Session store not set on request. I using stateful sanctum

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

    Is it possible? Laravel as backend and NuxtJs as a frontend to host into the same domain.

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

      of course why not?

  • @КириллБелоусов-ы5е
    @КириллБелоусов-ы5е 3 года назад

    in which folder is the admin panel created? in client project or inside laravel project?

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

    great !!!

  • @АнтонРевякин
    @АнтонРевякин 3 года назад +1

    But how to register via auth-next???

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

    in LoginController Unhandled \Illuminate\Auth\AuthenticationException for throw new AuthorizationException

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

    you did not provide middleware:['auth'] in nuxt.config , means your routes are not procteded on client side , you can acess any route without being logged in.If you add that , like docs says , than refreshing the page always redirects you to login even if you are already logged in.This is broken lib completely, just look at git issues

  • @Mahmudulhasan-ts5hm
    @Mahmudulhasan-ts5hm 3 года назад +1

    how to use SPA auth and TOKEN auth both together ?

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

    is their a video about registering a new user?

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

      I was wondering on that but registering a user does not use nuxt auth with sactum, you have to manually do that, send an API request to a register route in your laravel project but you will encounter CORS issues when doing that, to remove the CORS issues, first you have to make a request to Sanctum CORS then make your register request to the server.

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

      @@ezekielwachira1691 oh yeah,, I actually figured it out, I create an API for my register function. Thanks :)

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

    '/user' already return unauthentication
    !!!!

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

    i have a problem with CORS on localhost. What to do?

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

      I had the same problem and changed the paths on the config file: cors.php :
      'paths' => ['api/*', '/sanctum/*'],
      then cleared cache with (important!):
      php artisan config:gache

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

    theme vscode?

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

    This doesn't work with nuxt3

  • @Mahmudulhasan-ts5hm
    @Mahmudulhasan-ts5hm 3 года назад

    show to add register in this process?

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

      I was wondering on that but registering a user does not use nuxt auth with sactum, you have to manually do that, send an API request to a register route in your laravel project but you will encounter CORS issues when doing that, to remove the CORS issues, first you have to make a request to Sanctum CORS then make your register request to the server.

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

    CORS issues happening

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

      github.com/nuxt-community/proxy-module

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

      I had the same problem and changed the paths on the config file: cors.php :
      'paths' => ['api/*', '/sanctum/*'],
      then cleared cache with (important!):
      php artisan config:cache
      laravel doesn't load the cors.php config file edits until you clear the cache hence the cors error

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

      @@douglasokonu2653 I solved it using proxy module 🤞

  • @SohailKhan-tc8uz
    @SohailKhan-tc8uz 3 года назад

    Hi bro first comment

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

    thanks . can u help me out when i get this error No 'Access-Control-Allow-Origin'

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

      I had the same problem and changed the paths on the config file: cors.php :
      'paths' => ['api/*', '/sanctum/*'],
      then cleared cache with (important!):
      php artisan config:gache
      then it worked

    • @omareliotorrescastillo4808
      @omareliotorrescastillo4808 6 месяцев назад

      @@douglasokonu2653 this solution does not work

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

    CORS errors everywhere. Tutorial is completely useless now, don't waste your time.

  • @JesusGil90
    @JesusGil90 Год назад

  • @masaakiuechi6190
    @masaakiuechi6190 Год назад

    If you are having 401 unauthorized error after loggin, fix SANCTUM_STATEFUL_DOMAINS on .env file to " SANCTUM_STATEFUL_DOMAIN". It worked for me...