Laravel Sanctum (Airlock) SPA Authentication

Поделиться
HTML-код
  • Опубликовано: 6 окт 2024
  • Want more? We have two courses on Sanctum SPA authentication with Vue CLI and Nuxt. Check them out here:
    codecourse.com...
    codecourse.com...
    Official site
    www.codecourse...
    Twitter
    / teamcodecourse
    #laravel #vue #nuxt

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

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

    Recommend on using Redis or Memcached for sessions, not cookies and the other, u do not need to whitelist airlock csrf get request (it os a get, not a post) + no /login. just add that to the api route pointing to same one in the web

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

    Thanks Alex first PHP cource for my PHP experience your cource PHP messaging system on 2012
    I am happy to here your voice after 7 years
    I love you man thanks a lot

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

    This is a brilliant video. Airlock was confusing me a bit. You cleared up a lot. Thanks!

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

    This immediately caught my attention! I saw this when it was in development, but wasn't how it was to compare to Laravel Passport. So, essentially here, what we are doing is utilising CORS for security to authorize the front-end application, rather than an OAuth client ID and secret pair (since they can't be securely stored in a JavaScript app)?
    This is very promising, as SPA authentication has been tough when serving outside of the Laravel app.
    Great video, straight to the point - thanks!

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

      You only allow the front-end to make call to the api (ex: front-end.com calls api.front-end.com, not-my-front-end.com can't make requests due to CORS errors)

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

    Hi, will you consider expanding on this video? There are many more important points to cover, such as email notifications (verification, password reset, etc). The link is set to the API, but it should be the front-end vue app url

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

    Thank you so much! you really helped me understand what is going on behind the scene

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

    Good to hear from you thought you had no business with php after many years

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

    I got error 401 (Unauthorized) when access /api/user

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

      Did you solve it? I have the same problem.

    • @Aaron-bh8rh
      @Aaron-bh8rh 4 года назад

      ​@@Irsatechnologycomake sure you include the domain:port of your client side, e.g localhost:8080, in your sanctum stateful config

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

      @@Aaron-bh8rh thank you. I'm sure but I use nuxt and I think it's different. I'm learning it.

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

      In Providers/RouteServiceProvider.php try replacing ... middleware(['api']) to middleware(['web']), like this:
      protected function mapApiRoutes() { Route::prefix('api') ->middleware(['web']) ->namespace($this->namespace) ->group(base_path('routes/api.php')); }

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

    Whenever I open the web app, XSRF-TOKEN cookie is already set. What's the use of calling the airlock/csrf-cookie URL then? Any idea?

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

      when requesting from a page that was not provided initially by that laravel app, For ex., from a VUE SPA created by VUE CLI or Nuxt.js

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

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

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

    ay bro, can you do one of how to put a certain image to other image as a watermark of some sort.

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

    Make sanctum auth with multiguards

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

    I am wondering how to implement (logout other devices) by using Sanctum ?

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

    thank you for this useful video! just one simple thing. you said you have a course for laravel airlock API Token Authentication...! i couldn find it . did you record that or you will in next days?

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

      Glad you found this helpful! You can the token course just here: codecourse.com/courses/api-token-authentication-with-laravel-airlock

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

    I got error 401 (Unauthorized)

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

      Has you solved it?

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

      Did you solve it? I have the same problem

    • @Aaron-bh8rh
      @Aaron-bh8rh 4 года назад

      @@snelinternet4654 make sure you include the domain:port of your client side, e.g localhost:8080, in your sanctum stateful config

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

      In Providers/RouteServiceProvider.php try replacing ... middleware(['api']) to middleware(['web']), like this:
      protected function mapApiRoutes() { Route::prefix('api') ->middleware(['web']) ->namespace($this->namespace) ->group(base_path('routes/api.php')); }

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

    Why blocked by policy in laravel 8?

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

    hello, could you tell the name of color theme that you use ?

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

    apparently this doesn't work with Safari?

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

    Does this work exactly the same as Sanctum and if i want to have a Vue/React repository that is not within my Laravel project?

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

    Nice video!

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

    Hello, does anyone knows how to change localhost:3000 to custom domain for an example nuxt-app.test? I wasn't using localhost at all and now with nuxt im stuck. In the normal vue app, I was able to create vue.config.js file and inside = devServer: { host: 'app.airlock.test' }
    I got as response during login csrf-cookie status 204 containing laravel_session, XSRF-TOKEN, 85IMh9HgHJTNinft82Edf3jAoOrkaFcZX0ziRVEQ
    but im not able to login with that I got - CSRF token mismatch, I guess its becouse of my nuxt runs on localhost and laravel on airlock.test, so they have different origin.... Thanks for help

    • @ДаниилКедров
      @ДаниилКедров 4 года назад

      I have same problem. I'm getting 204 response , but cookies not sets. How you solved this problem?

    • @felipeap.4076
      @felipeap.4076 4 года назад

      Dude, try send withCredentials: 'true' with your axios request

  • @LucasSilva-pe8sw
    @LucasSilva-pe8sw 3 года назад

    what is this theme vscode

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

    I have subscribed to the Codecourse website, but after I revoked my credit card, my subscription was immediately lost, even though I just subscribed for less than 1 day, can it be returned, because I only want to subscribe for 1 month without renewal, please help, because I feel wronged

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

    Hi Alex
    Can you add subtitle or CC in codecourse.com?

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

    Does this still work for you?
    From one day to another (was working before) it's not working anymore for me.
    I read around that is due to an update to chrome.
    Shortly, i'm thinking to switch to Passport or Jwt, due to the lack of info.
    Also Taylor wrote:
    twitter.com/taylorotwell/status/1229560998098542597
    twitter.com/taylorotwell/status/1229615721237372929
    I'm in localhost, Laravel 7 + Nuxt.
    If you could help us with this, would be appreciated.

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

    password: ilovecats 😺😺

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

    brother please make a full node.js tutorial(with mysqli database) please i have learnt php Alhamdulillah(all glory to Allah) by watching your tutorials.

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

    Thanks For waisting my time

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

    360p??? is this 2010?

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

      It takes a while longer for youtube to get the 1080p version rendered compared to the 360p one. look again now

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

      It's weird people still complain about this in 2020. It's been common knowledge for some years now

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

    I'm using sanctum and get 401 error when I call /api/user

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

      Did you solve it? I have the same problem

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

      No unfortunatily I can't resolve this

    • @Aaron-bh8rh
      @Aaron-bh8rh 4 года назад +1

      @@luismolina9442 make sure you include the domain:port of your client side, e.g localhost:8080, in your sanctum stateful config

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

      In Providers/RouteServiceProvider.php try replacing ... middleware(['api']) to middleware(['web']), like this:
      protected function mapApiRoutes() { Route::prefix('api') ->middleware(['web']) ->namespace($this->namespace) ->group(base_path('routes/api.php')); }