// AuthServiceProvideruse Laravel\Passport\Passport;...publicfunctionboot(){...Passport::tokensCan(['list-clips'=>'List sound clips','add-delete-clips'=>'Add new and delete old sound clips','admin-account'=>'Administer account details',]);}
Example 13-40. Using middleware to restrict access based on token scopes
// routes/api.php
Route::get('clips', function () {
// Access token has both the "list-clips" and "add-delete-clips" scopes
})->middleware('scopes:list-clips,add-delete-clips');
// or
Route::get('clips', function () {
// Access token has at least one of the listed scopes
})->middleware('scope:list-clips,add-delete-clips')