0

I've inherited a project that uses Laravel's authentication for an admin panel. The admin panel takes advantage of routes from both web.php and api.php. The people who log into the admin panel are called users. This project has also has an API used to communicate with an app, with routes described in api.php. The people that log into this app are called members. The user authentication was already set up and is working, but I'd like to add token-based authentication for members.

After doing some research, it looks like Sanctum is a good solution for bearer tokens for the app members, but when I try to implement it, there seems to be some interference with the already-in-place user authentication.

When I make a route like Route::middleware('auth:sanctum')->post('/member/getMember', 'MemberController@getMember'), the response is always a redirection to the login page for a user, even when the bearer token is correct.

I'm not sure where to go/look from here, so any help is appreciated. Should I bother using Sanctum? Is there something I need to change in my LoginController.php, etc. that would fix this? Thanks.

bean710
  • 1
  • 2
  • 5

0 Answers0