我已使用此文档https://laravel.com/docs/master/passport
在Laravel 5.3中安装了Passport Auth但是我已经按照“Frontend Quickstart”前面的步骤进行了操作,现在我有一条API路线:
Route::get('/user', function (Request $request) {
//return $request->user();
return json_encode(array(
1 => "John",
2 => "Mary",
3 => "Steven"
));
})->middleware('auth:api');
我试图通过邮递员http://localhost/project/public/api/user
:Accept: application/json
它向我展示了这个输出:
{"error":"Unauthenticated."}
请告诉我如何使用护照身份验证来验证我的API?另外我如何生成access_token以进行授权?