Passport Version: 9.0
Laravel Version: 7.5.2
PHP Version: 7.4.0
Database Driver & Version:
Database client version: libmysql - mysqlnd 7.4.0
Description:
I am using Laravel 7.5.2 with Vuejs. I am using passport for api authentication. I am getting the following error when sending ajax request to api
{
"message": "Undefined index: aud",
"exception": "ErrorException",
"file": "E:\\laravel\\vendor\\laravel\\passport\\src\\Guards\\TokenGuard.php",
"line": 140,
"trace": [
{
...
}
]
Steps To Reproduce:
I have followed passport installation instruction on laravel website.
Has run composer require laravel/passport, php artisan migrate and php artisan passport:install
Has added HasApiTokens in user model
Has added Passport::routes() in AuthServiceProvider
Has added \Laravel\Passport\Http\Middleware\CreateFreshApiToken::class in App\Http\Kernel web middlewareGroups
Has changed Api driver to passport in config/auth.php
The cookie named "laravel_token" is getting generated and sent with ajax request as I can see in developer tool.
In my controller I have included api middleware as
public function __construct(){
$this->middleware('auth:api');
}
👍 React with 👍 2Zae and akizor