Laravel 9 Sanctum for React SPA Authentication (stateful)

preview_player
Показать описание
How to program Laravel and configure Sanctum with CORS to be backend for React SPA Authentication.

Backend:
- Laravel 9
- Sanctum
- CORS
- Laravel Valet
- PHP 8.1

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

Finally someone who does it properly. GJ man, keep going

wayz
Автор

Thanks, I was yesterday all day long trying to make a post request, but I couldn't 'cause got "CSRF token mismatch", but now it works.

insitegd
Автор

tons of thanks brother.. i've watched many videos many tutorials and i've to buy a course a Udummy for this solution.. . but nothing help me than i got your video that's help me alot.
thanks a lot sir
you are new here you helped me. now it's my time to help you back... thanks a lot

musiclovers
Автор

Awesome! I love valet now. Thank you so much. It's really helpful.

mktNo
Автор

I do the same, but my CSRF-TOKEN is not installed, why? only i use react as localhost:3000

dima
Автор

Why is it not working in Google Chrome?

ipwkdxk
Автор

Does not work with Laravel 10 i think, getting 401 error on /user route, everything before is fine.

MyAnimeForLife
Автор

Thanks for such a good tutorial. I get the login to work but when I call the api/user it returns 401 (Unauthorized). Can you tell me what might be going on?

juanalbertocaceresvega
Автор

how can i run react on a virtual host without including port number, because i can't cope up with your because that

mohammedattar
Автор

Thsnk you so much 🙏🏻 auto subscribe your channel

reizrnajah
Автор

So, when you are logged, and the cookie is saved, you can get responses without pass the token on headers? Sorry for my poor english

luchodomizi
Автор

I do the same but why my cookies not generated?

dennishalili
Автор

is it really required to transfer to sqlite?

marcoantonio
Автор

im having 401 issue, i can pay for solve it, if you are interested please contact me, im really troubleshooting and i need to finish the work

kan_beats