Released earlier this year, Laravel Sanctum (formerly Laravel Airlock), is a lightweight package to help make authentication in single-page or nati...
For further actions, you may consider blocking this person and/or reporting abuse
I did all these steps, but when i am trying to get user data i get Unauthenticated error
routes/api.php
home.vue
I do not know if i did any thing wrong ?
Happening the same to me :(
I solved it , in your Providers/RouteServiceProvider.php, change the mapApiRoutes function from middleware(['api']) to middleware(['web'])
Hope this helping you.
Great work, please i will like to have a little chat with u man
This is not a good solution,
The solution is to set value for
in the .env file
Hi. Thank you for this amazing article. ☺️
Just got a question:
Why are you asking for a CSRF token right here ? I'm asking because I don't do that and I'm interested about learning something else here. 🤗
Thanks !
when I want to use it with nuxt js I have many problems . I reveive data correctly from api but there is anything to do. how can I debug it. this is my setting in nuxt:
this is my login.vue
this is login api:
Suppose there are 2 apps :
My app (app 2) will provide API that can be consumed by app 1, i.e app 1 can post employee records to my app (post/put request) as well as retrieve performance data (get request) from my app.
Is Sanctum adequate for this kind of apps ? I have read both Passport (OAuth 2) and Sanctum, but am still not sure which one I will pick.
Nice write up. I have Larave/Sanctum working well with Quasar with Vuex - wondering if there is a good way to know on the vue side if the user is authenticated - or perhaps at the login process I just need to track that state myself. I'm loading their user data into Vuex but on refresh it's lost, while the authentication is maintained - I'd like to query that auth state to then re-query the user details.
Can I use this with a project that is not SPA
Great article, gets me ready to add this to my SPA too! I noticed a small error in the text where you write about the laravel ui package. I think this was first added in Laravel 6.