Closed abdallahalsamman closed 1 year ago
I'm trying to add https://github.com/robsontenorio/laravel-keycloak-guard to my project,
I added a route under the auth:api middleware after installing the above library. but when I go to it I get an "Unauthenticated." error.
Route::group(["middleware" => "auth:api"], function () { Route::get('test', [AuthController::class, 'test']); });
public function test(Request $request) { dd(Auth::token()); }
And below is an image showing the exception
The request has an Authorization header of a keycloak access token
I made sure I change my auth guards in config/auth.php like so:
config/auth.php
'defaults' => [ 'guard' => 'api', 'passwords' => 'users', ], 'guards' => [ 'web' => [ 'driver' => 'api', 'provider' => 'users', ], 'api' => [ 'driver' => 'keycloak', 'provider' => 'users', ] ],
What should I do to get the test method to return the correct token?
turns out the modheader extension removed my tab filter on it's own so it wasn't sending the Authorization header, solved!
I'm trying to add https://github.com/robsontenorio/laravel-keycloak-guard to my project,
I added a route under the auth:api middleware after installing the above library. but when I go to it I get an "Unauthenticated." error.
And below is an image showing the exception
The request has an Authorization header of a keycloak access token
I made sure I change my auth guards in
config/auth.php
like so:What should I do to get the test method to return the correct token?