Laravel 11 API in 13 minutes | Sanctum
HTML-код
- Опубликовано: 13 апр 2024
- Hello everyone,
In this video, we will see Laravel 11 and changes done for Sanctum. We will also create a fundamental API.
Laravel 10 Sanctum crash course
• Laravel API with Sanct...
Follow me on Twitter:
/ adir1521
Follow me on LinkedIn
/ adityakadam2194
Follow me on GitHub
github.com/adityar15
Website
adiranids.com
Discord
/ discord - Наука
Спасибо!
How did you config csrf token in Laravel?
i use Laravel11 sanctum session (not token) Login and logout (endpoints) are working correctly when called from postman but when I call other api end points it gives me 401 unauthorized
i would also like to know how you config csrf token.And can you create a project in laravel 11 for booking system
what is the code suggestion extension you use for VSCode?
if you found the answer, please share it. Thanks
I am using Github copilot
It works, thanks. However there is a small problem.
If I try to access the resources directly without providing the bearer token on api route, it tries to redirect to login route instead of returning unauthorized error. How do I fix it?
Method 1:
Add header: Accept: application/json
Method 2:
Manually validate Login using the Auth class
@@kamauleao thanks
CSRF token mismatch. even the XSRF is set
when i try it, i get error "Page Expired" on register, any have same problem?
I had to add a new header variable key: X-XSRF-TOKEN, value: {{xsrf-cookie}}
I can also suggest you add key: Accept, value: application/json (so that you actually see validation errors).
@@thomaswikman2239 same thing, inserting the parameter in the header and the value doesn't change, too bad
superb, need more videos , i am basics Learner
best lesson bro! tnx so much!
When I try without login it redirect to login page
Method 1:
Add header: Accept: application/json
Method 2:
Manually validate Login using the Auth class