Skip to content

Commit

Permalink
[SDK-3716] Do not require session configuration for stateless strateg…
Browse files Browse the repository at this point in the history
…ies (#317)

* Do not require session configurations for stateless/API-only strategies

* Fix incorrect named argument call
  • Loading branch information
evansims authored Oct 14, 2022
1 parent 66be365 commit 2bdf37c
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/Auth0.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,24 @@ public function getConfiguration(): Configuration

$configuration = new Configuration($config);

// If no sessionStorage is defined, use an LaravelSession store instance.
if (! isset($config['sessionStorage'])) {
$configuration->setSessionStorage(
new LaravelSession($configuration->getSessionStorageId()),
);
}
if (! \in_array($configuration->getStrategy(), [Configuration::STRATEGY_API, Configuration::STRATEGY_MANAGEMENT_API], true)) {
// If no sessionStorage is defined, use an LaravelSession store instance.
if (! isset($config['sessionStorage'])) {
$configuration->setSessionStorage(
sessionStorage: new LaravelSession(
prefix: $configuration->getSessionStorageId()
)
);
}

// If no transientStorage is defined, use an LaravelSession store instance.
if (! isset($config['transientStorage'])) {
$configuration->setTransientStorage(
new LaravelSession($configuration->getTransientStorageId()),
);
// If no transientStorage is defined, use an LaravelSession store instance.
if (! isset($config['transientStorage'])) {
$configuration->setTransientStorage(
transientStorage: new LaravelSession(
prefix: $configuration->getTransientStorageId()
)
);
}
}

// Give apps an opportunity to mutate the configuration before applying it.
Expand Down

0 comments on commit 2bdf37c

Please sign in to comment.