Hi guys , I had to add dinamically auth0 credentials load from db.
I succeded doing following modifications to Auth0.php
class (after line 30):
public function getSdk(): \Auth0\SDK\Auth0
{
if ($this->sdk === null) {
$this->sdk = new \Auth0\SDK\Auth0([
'strategy' => env('AUTH0_STRATEGY', 'webapp'),
'customDomain' => env('AUTH0_CUSTOM_DOMAIN'),
##TENANT SPECIFIC
'domain' => \App\Helpers\ClassAuth0Creds::get_AUTH0_KEY('AUTH0_DOMAIN'),
'clientId' => \App\Helpers\ClassAuth0Creds::get_AUTH0_KEY('AUTH0_CLIENT_ID'),
'redirectUri' => \App\Helpers\ClassAuth0Creds::get_AUTH0_KEY('AUTH0_REDIRECT_URI'),
'clientSecret' => \App\Helpers\ClassAuth0Creds::get_AUTH0_KEY('AUTH0_CLIENT_SECRET'),
##/TENANT SPECIFIC
'audience' => \Auth0\Laravel\Configuration::stringToArrayOrNull(env('AUTH0_AUDIENCE')),
'scope' => \Auth0\Laravel\Configuration::stringToArrayOrNull(env('AUTH0_SCOPE')),
'organization' => \Auth0\Laravel\Configuration::stringToArrayOrNull(env('AUTH0_ORGANIZATION')),
'cookieSecret' => env('AUTH0_COOKIE_SECRET', env('APP_KEY')),
'cookieExpires' => env('COOKIE_EXPIRES', 0),
'cookieDomain' => env('AUTH0_COOKIE_DOMAIN'),
'cookiePath' => env('AUTH0_COOKIE_PATH'),
'cookieSecure' => \Auth0\Laravel\Configuration::stringToBoolOrNull(env('AUTH0_COOKIE_SECURE'), false),
'routes' => [
'home' => env('AUTH0_ROUTE_HOME', '/'),
'login' => env('AUTH0_ROUTE_LOGIN', 'login')
]
]);
$this->setSdkTelemetry();
}
return $this->sdk;
}
This is working ok but Im doing something nasty regarding repository good practices since Im modifiing libraries inside my vendor folder.
So question is:
How can I create my own class and call it from the config files or implement another way to properly solve it? Any advice would be wellcome.
Regards.