Level 12
Unauthorized means the token you're passing is not valid. Have you passed the Login token with the request headers?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
working with Laravel 8 and fetch data using postman. I have following controller functions to show users data AuthController
public function index()
{
$users = User::all();
return send_response('Success', $users);
}
api
Route::middleware('auth:api')->group(function () {
Route::get('/users', [AuthController::class, 'index']);
});
but when I run following url on postman using GET method
http://localhost:8000/api/v1/users/
I got following message on postman
{
"message": "Unauthorized"
}
how could I fix this problem?
Unauthorized means the token you're passing is not valid. Have you passed the Login token with the request headers?
Please or to participate in this conversation.