Closed Shawlee76 closed 2 years ago
This happens because in some way the client has sent an empty token on request.
See $this->request->bearerToken()
is a native Laravel function to extract the bearer token from request header.
https://github.com/robsontenorio/laravel-keycloak-guard/blob/master/src/KeycloakGuard.php#L39
So, this is out of scope this package.
Hi, On my production server, I have this error even on public endpoints :
Argument 2 passed to KeycloakGuard\Token::decode() must be of the type string, null given, called in robsontenorio/laravel-keycloak-guard/src/KeycloakGuard.php on line 39
0 robsontenorio/laravel-keycloak-guard/src/KeycloakGuard.php(39): KeycloakGuard\Token::decode(NULL, NULL)
1 robsontenorio/laravel-keycloak-guard/src/KeycloakGuard.php(27): KeycloakGuard\KeycloakGuard->authenticate()
2 robsontenorio/laravel-keycloak-guard/src/KeycloakGuardServiceProvider.php(21): KeycloakGuard\KeycloakGuard->__construct(Object(Illuminate\Auth\EloquentUserProvider), Object(Illuminate\Http\Request))
3 Illuminate/Auth/AuthManager.php(111): KeycloakGuard\KeycloakGuardServiceProvider->KeycloakGuard\{closure}(Object(Illuminate\Foundation\Application), 'api', Array)
4 Illuminate/Auth/AuthManager.php(88): Illuminate\Auth\AuthManager->callCustomCreator('api', Array)
5 Illuminate/Auth/AuthManager.php(68): Illuminate\Auth\AuthManager->resolve('api')
6 Illuminate/Auth/AuthManager.php(54): Illuminate\Auth\AuthManager->guard('api')
I don't have this problem on dev (local). Thanks for your help.
Charlie