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

AbdallahSabri's avatar

Error when I move my API project to live server

I created an api using laravel, it works fine on local development machine, but when I go to live server (Centos, Apache, PHP 7.2, Mysql) I get Unauthenticated, I test this url for testing (it works fine on development)

When I run this code

Route::get('test', function ( Request $request ) {
    return 'aaaaaaaaaa';
})->middleware(['auth:api']);

I get this error

{
    "message": "Unauthenticated."
} 

I just changed the ip address and the authentication key.

what cause this problem?

0 likes
0 replies

Please or to participate in this conversation.