我正在制作单页应用程序,在处理get请求时,我已经传递了X-CSRF-TOKEN
和X-Requested-With
头部。我还在web中间件组中包含了\Laravel\Passport\Http\Middleware\CreateFreshApiToken::class
。我的api.php路由看起来像:
Route::get('categories','Api\Categories@index')->middleware('auth:api');
但请求指定的URL会显示未经身份验证的消息。
config/auth.php
文件中设置了 API 认证驱动程序为passport
吗? - samrap