Laravel API Auth with Sanctum and API Tokens

preview_player
Показать описание
This is a free lesson from my upcoming course "How to Create Laravel API". We take a look at one of the ways to authenticate the API user - by issuing a long-term token which will be used in all the requests.

Subscribe for -50% discount for the upcoming course:

- - - - -
Рекомендации по теме
Комментарии
Автор

Two days trying to understand it and suddenly this video saves my life in a few minutes.
Thank you.

jhonbarcasnegras
Автор

Thankyou for your brief & clear explanation, straight to the point & solving my problem

HansVandetas
Автор

Love your content
Just bought the course
All the best man <3

redamakarem
Автор

This was killing me with pain but just a minute you made my day happy DUDE

evangelistenockmwakapalila
Автор

thank you so much your explanation so clear

Mocka-yfez
Автор

If I use a "role abilities" approach (for the User model), the token ability can be bypassed or should that be considered a totally different type of authorization?

vladimircontreras
Автор

Thank you. I was stuck on using a token from database which is encrypted? I guess. Did not realize I needed to use plaintext one.

Shortgrauzis
Автор

Hi
I've protected my route with Sanctum API Token as you describe, but I've a question: when I call route internally, in my code with the 'name()', I'd like to bypass the auth. What is the best practice?
Thank you.

vlauciani
Автор

Hey! Can you please validate the below? When using Sanctum API Tokens tokenCan() is used instead of Gates and can(). While when using Sanctum with Vue (for instance), Gates and can() are the ones used instead of tokenCan()? From what I understand, Sanctum SPA Auth makes use of Laravel Session, hence Gates are just natural to be used. While, Laravel API Tokens, is something else relying heavily on Token + Abilities. Thanks!

bhaidar
Автор

Thanks a lot, Povilas! You helped so many people. One question. What can be wrong with the following? I made everything according to this video, but in the very end when in the controller I try to use auth()->user()->tokenCan() it falls because auth()->user() is null. Maybe someone else here can know? My API controller cannot see the user.

repetitoraru
Автор

What is the best way to protect Vue page with Sanctum?

MoawiaAlmardoud
Автор

do you have any guide to build portal website using laravel and connect to this api?

nguyenhoa
Автор

Is there a way where we can delete all tokens which are not used anymore using a scheduler?
Thank you in advance.

frank_core
Автор

but anyone with access to the public SPA can look at the requests made vis the browser console and steal that bearer token. How is this secure?

diegoc
Автор

sir please help me i want to apply sanctum on my custom created model instead of user.php what I have to do kindly help me?

mnafaykhan
Автор

I always follow your great tutorial videos. I learned lots of things from here. I developing a laravel vue spa project with laravel sanctum but when I Deploy my project on sub domain. I am getting 401 error. Can you please make a video on laravel sanctum project deploy on live server

raziburrahman
Автор

What's the sense of a "white list" of web tokens?

TechWizardBoctulus
Автор

Great Tutorial. Is it possible to combine Sanctum API Tokens with Passport/JWT instead of Sanctum SPA Authentication ?

agustinarroyosotomayor
Автор

I think the show function returns 403 status because token named categories-show is not made. Am I right?

birenjung
Автор

Sad that there is no refresh token functionality

tomm