Laravel 8 tutorial - API authentication with Sanctum

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

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

  • @Softwaretube91
    @Softwaretube91 3 года назад +3

    Simple and straight to the point. Thank you sir.

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

    Great job man. I love the way you are teaching. thank You So Much

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

    Thanks so much sir! I have really learned so much concerning the auth access tokens for authenticating APIs.

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

    Great tutorial. Very easy to follow and nicely explained. Really helped me understand it all. Thanks.

  • @lubosflorek1810
    @lubosflorek1810 4 года назад +14

    Just for information, if you are getting error 500 when user is unauthenticated just add header to a request - Accept : application/json, then you will get proper error 401. Also don't forget to revoke old tokens otherwise your table gets filled pretty quickly

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

    Nicely Explained it and works perfectly. Thanks a lot.

  • @shoulieheinds5528
    @shoulieheinds5528 4 года назад +5

    cool tutorial sir.... thank you, it's very helpfully

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

    great tutorial man.. thank you.. keep up the good work..

  • @nuruzzanamhimel5911
    @nuruzzanamhimel5911 Год назад +1

    Very wonderful video

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

    Thank you so much sir. This works perfectly.

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

    Very useful ... Thank a lot

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

    Thanks so much Anil

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

    Thanks, you saved me❤

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

    Thanks, very good video, you are a crack !!!

  • @nayeemchowdhury2497
    @nayeemchowdhury2497 8 месяцев назад

    good

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

    nice

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

    hii sir.. i like ur laravel videos and the way u teach but in this video u have'nt shown about member model, controller .. also will u please also upload a video for laravel 8 passport api as u uploaded for sanctum.

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

    which is good this or passport package ???

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

    I am not sure but what I understood is: Sanctum is used for Single Page Application which use sessions and validates users where as Passport is used when are communicating between different applications which uses oauth2. Please correct me if I am wrong

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

      Sanctum allows both, sessions first and then API. But for Sanctum API authentication, instead of OAuth, it uses personal access tokens placed on header requests. If you need to expand/implement Mobile App access in the future that allows the use of accounts in 3rd party apps like FB, Twitter, etc. (all of which uses OAuth2), then use Passport. Sanctum doesn't provide OAuth2.

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

    how about when we see member data but only specific data when entering the token?

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

    ok good it's working for me

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

    thanks for the video, how do you catch the error....incase you don't use the token

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

    sir can you demonstrate this video without postman extension i mean live

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

    how can i show a message to user when they are not logged in but trying to fetch a secured url. Its always giving an error but how can i send custom error

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

    সুন্দর

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

    Man you're great 😘😘

  • @ShivKumar-mq5gh
    @ShivKumar-mq5gh Месяц назад

    what is the use of bearer and when you ganrate

  • @RamuRamu-eu2sx
    @RamuRamu-eu2sx 4 года назад

    Sir sanctum or jwt which one better

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

    Sir i am facing a problem during instalationl the santum i am not getting some table name in date base after migration....in my system after run migrate command iam getting some error

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

    Publish command k bd configurations or migrations add hni hn wo add ni horaen and then there is nothing to migrate. what to do?

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

    Shouldn't your index function inside your UserController be declared public??

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

    i can't see membercontroller , how can i look?

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

    sir will you give me the link for role and permission in laravel using spatie or any else.

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

    Hello, can you please tell or show a link to an example. how fashionable to get data with authentication not through postman but through JavaScript?

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

    Please make video about passport authentication

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

    *Uses documentation*
    *Doesn't provide link to documentation*
    I don't know what is wrong

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

    thanks sir

  • @ABHISHEKKUMAR-ne3rk
    @ABHISHEKKUMAR-ne3rk 3 года назад

    Is it possible to display api data into blade..

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

    how to delete api individual token or how to logout user kindle make it video on this

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

    Is this called REST apis?

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

    All the code worked fine for me! But when I deployed in the live server, it just returns an unauthenticated error even after the successful login. Will you please help to solve the error?

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

    Like magic

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

    Laravel k package Kitna hote h or kya kya krte hai..plzz explain

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

    no link in description bro , where i can get link

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

    Sir Many times whenever i install the laravel and run migrate command it shows key id too long why?

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

      same

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

      go to AppServiceProvider.php and add these lines
      use Illuminate\Support\Facades\Schema;
      public function boot()
      {
      Schema::defaultStringLength(191);
      }

  • @AnkurSingh-tt7mu
    @AnkurSingh-tt7mu Год назад

    What is difference of passport nd jwt md any know please explain me

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

    why are you not using or setup passport ?

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

    Sir, why we must supply word 'Bearer' in the value for authorization in Headers. Why not can we just supply the token instead

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

      This is just prefix, almost all token library require this prefix.

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

    Hey first comment

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

    you must to buy GX40 Official tools in leakfullz,

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

    If token is wrong I get 500 instead of 401.. Why?
    thx .all's good. I forgo to add Accept: application/json to request header

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

    how we use sanctum in oracel db and change authincate table name

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

    the token returned, i should store it, right ? ...... what if i'm working with roles and permissions ? ........ how do i check if that user has required privileges with just the token

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

      @pwcodigo someone else recommended bouncer package

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

      I have same your question! did you found answer for it

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

      You can write a middleware to perform those checks

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

    I get error msg 'route login not defined' when opening protected page on a browser. i checked with auth::check and its logged in. i used xmlhttprequest and passed the credentials. the response returned true (based on auth::check) and i tried opening the protected page in a new tab in javascript. i have define route in authcontroller(tried both, get and post), just started to learn laravel, what wrong am i doing.

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

      place the signin and login route outside the middleware group and pass the token in header

  • @dirkk.6828
    @dirkk.6828 4 года назад

    How can I bring the authorisation and the URL together?

  • @346ask
    @346ask Месяц назад

    Your guide makes me so mad, so much code missing and you don't link previous tutorial in your video description.

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

    this is not working in production server ...
    its only worked when we run it with php artisan serve

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

    How to handle created token in Laravel as a header Authorization Bearer "Token"

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

    i wish he could explain how register function should be written seeder won't help me in the front end

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

    How can we use jwt auth

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

    please do organize your channel because its waste too much time to search a relevant video and add links in every video like github link in this video

  • @RizwanKhan-yn9yb
    @RizwanKhan-yn9yb 3 года назад

    how to delete a token or logout?

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

    Source Code ?

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

    I'm getting this Error

  • @Benjamin-vx2ot
    @Benjamin-vx2ot 2 года назад

    @11:48 no, not "right"...no link in here

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

    What's difference between Passport And Sanctum Packages

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

      passport uses JWT based authentication.

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

      @@cmm3338 what is JWT

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

      @@jashanpreet832 JSON web token,

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

      Ok can we use sanctum instead of passport

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

      @@jashanpreet832 Depends on the type of application you are building, the short answer yes.. the actual answer, depends on your use case as to whether it is the best option or not. Not enough information. Passport is a full fledged Oauth implementation, sanctum just provides a token for authentication. If all you need is basic authentication to your 'api' routes, then yes.. Sanctum will work great.

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

    this tutorials can not help any developer to improve in learning !

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

    Error: Call to undefined method stdClass::createToken()

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

      I had the same problem and it turned out I didn't copy the 5:15 fragment of code inside User class

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

    I really do not believe this tut has been watched for more than 50 k very bad technuiques are used .

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

    it is laravel not laravebel

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

    Very cool login, But where is registration? for dumb ones like me that need to see

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

    How to add prefix in default /login & /register api in laravel sanctum ?
    Ex. Default api are /login & /register
    I want /api/login & /api/register
    How to achieve this?
    Also in /user api i am getting many fields like id,name,email,created_date
    I just want name and email id
    How to do that?

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

    Thanks sir