how to distinguis errors message between expired token and invalid token

  Kiến thức lập trình

I want in my API response when token expired it will return message “token expired” with status code 419, and when token invalid return “Unauthenticated” with status 401.

How can I do that?

I only use the basic of usage laravel sanctum, and I expect I can custom the response of Laravel sanctum when it expired token different with invalid token.

New contributor

Muhammad Hizbullah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT