0
votes

I'm new in laravel. I have a laravel 5.8 project with passport which that works very well on my local server , I transfer all code to a share server in a subdomain, where registration and login route work well but , routes in auth:api middleware group always return the unauthenticated error, why does this happen?

"laravel/passport": "7.5.1",

routes/api.php

Route::post('login', 'API\UserController@login');
   Route::post('register', 'API\UserController@register');
   Route::group(['middleware' => 'auth:api'], function(){
       Route::post('apilogout', 'API\UserController@apilogout');
       Route::post('details', 'API\UserController@details'); 
  });

Im sending this header information from postman

I follow this url for passport : https://medium.com/techcompose/create-rest-api-in-laravel-with-authentication-using-passport-133a1678a876

1

1 Answers

0
votes

maybe you need this on your Model Class?

protected $guard = 'yourGuardHere';

Can you upload your code, please