Is there any way to protect some api that has no login requirement using laravel sanctum?

  laravel, php

This is my first time using laravel sanctum. Before this, I use Laravel Passport for protecting the route.
So the problem is, there are 2 kind of route. Route that need user authentication, like API profile, my order, and inbox. And route that doesn’t need user authentication to access, like API version control, splashscreen, and forgot password.
In my last project when using passport, in passport there was client token, that doesn’t need user credential to get. Then I use auth_client middleware to protect route that doesn’t need user authentication. First I want to ask, is this the correct way?

If that was correct way, and protecting no need login route is recommended, how i do the same thing using laravel sanctum?

Source: Laravel

Leave a Reply