Skip to content

Commit 835febb

Browse files
Add auth guard to routes (#1603)
1 parent 662325a commit 835febb

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

config/passport.php

+13
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
return [
44

5+
/*
6+
|--------------------------------------------------------------------------
7+
| Passport Guard
8+
|--------------------------------------------------------------------------
9+
|
10+
| Here you may specify which authentication guard Passport will use when
11+
| authenticating users. This value should correspond with one of your
12+
| guards that is already present in your "auth" configuration file.
13+
|
14+
*/
15+
16+
'guard' => 'web',
17+
518
/*
619
|--------------------------------------------------------------------------
720
| Encryption Keys

routes/web.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
'middleware' => 'web',
1515
]);
1616

17-
Route::middleware(['web', 'auth'])->group(function () {
17+
$guard = config('passport.guard', null);
18+
19+
Route::middleware(['web', $guard ? 'auth:'.$guard : 'auth'])->group(function () {
1820
Route::post('/token/refresh', [
1921
'uses' => 'TransientTokenController@refresh',
2022
'as' => 'token.refresh',

0 commit comments

Comments
 (0)