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

bulgaria_mitko's avatar

Laravel Passport TokenMismatchException 'Unauthenticated'

I am trying to use Laravel Passport the latest version, but i am getting 'Unauthenticated' when trying to view the domain.com/api/user/ (default route that is provided with a new install of Laravel). I am able to get access token and refresh token, but when i try to use the access token to get the currently logged user i am getting this error

AuthenticationException {#580 ▼
  #guards: array:1 [▶]
  #redirectTo: null
  #message: "Unauthenticated."
  #code: 0
  #file: "/home/izdavamc/nima.bg/laravelcpanel/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php"
  #line: 66
  trace: {▶}
}

I have tried all those:

  • run composer update
  • i added this code to the .htaccess file: RewriteEngine On RewriteCond %{HTTP:Authorization} ^(.) RewriteRule . - [e=HTTP_AUTHORIZATION:%1]
  • i put this code inside Illuminate\Cookie\Middleware\EncryptCookies - protected static $serialize = true; but none of those worked for me :(
0 likes
0 replies

Please or to participate in this conversation.