Search code examples
laravellaravel-middlewarelaravel-sanctumlaravel-authorizationpackage-development

How to access Sanctum package in custom laravel package


i want to access laravel sanctum auth which is working fine in project routes I'm making a custom package of api's which needs to use same sanctum authentication with in the custom package routes


Solution

  • use auth sanctum middleware for your routes, See below example.

    https://laravel.com/docs/9.x/sanctum#protecting-routes