Support the ongoing development of Laravel.io →
API Passport

I'm new to Laravel passport API. Now the question is in Laravel-11 I'm using passport for authentication. In that when the request is unauthenticated the response is returning

{
    "message": "Unauthenticated."
}

but now I need to customize this response to

{
    "status": "failed",
    "statuscode": 422,
    "message": "Unauthenticated"
}

Can anyone try address my query. I got answer for Laravel version 10, but need solution for Laravel 11

devcodeur liked this thread

1

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.