Feb 20, 2023
0
Level 1
Token scopes with middleware
Hello
I have defined a series of scopes for the tokens. These are "level_1" and "level_2"
To allow access to a specific endpoint only for scope level_1 I do the following.
Route::middleware(['auth:authentication', 'scope: level_1'])->get('/v0/er/locations', [Controllers\LocationsController::class, 'getLocations']);
But how do I allow access to any scope? I have seen that one possibility is the following:
Route::middleware(['auth:authentication', 'scope:*'])->get('/v0/er/locations', [Controllers\LocationsController::class, 'getLocations']);
But that's not working. Could you please help me?
In order for the middleware to be for any type of scopes, the following is simply done, correct?
Route::middleware(['auth:authentication'])->get('/v0/er/locations', [Controllers\LocationsController::class, 'getLocations']);
I'd like to confirm this in case it might imply any future security flaws.
Please or to participate in this conversation.