Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

LuciferSam's avatar

Laravel Sanctum on a RESTful API : how to intercept the token receive event

Hello there, Laravel newbie here :)

I wrote a RESTful API and I've enabled Sanctum and the tokens work without problems.

Here my problem and question.

When I receive a token I should check a custom table on Database and if in this table I have some fields with particular values I have to return a 401 instead of return any route the remote client asked me.

Do you have some suggestion how I could achieve something like that? Thank you!

0 likes
1 reply

Please or to participate in this conversation.