Skip to content

Using Laravel's session store for the PHP SDK's sessionStorage/transientStorage #299

Closed
@nie7321

Description

@nie7321

What should be added?

I'm developing for Laravel Octane. One issue I ran into is that the default configuration for the package is to use cookies for the sessionStorage & transientStorage. The PHP SDK's CookieStore will call setcookie(), which won't work when running on Octane1.

I didn't see anything in the Laravel package to offer another driver, so I implemented a StoreInterface that uses the the framework's sessions.

However: It was a little difficult to configure this. It didn't look like I could just give the two storage parameters the classpath in config/auth0.php; it expected instances. That's a bit of a bummer since caching the config would fail2.

I have two suggestions for enhancements of the Laravel package:

  1. When a parameter in config/auth0.php is expected to be an object, allow it to be specified as a classpath and have the service container resolve it.
  2. Add a StoreInterface implementation that uses the framework's session driver.

Footnotes

  1. See the Laravel Swoole notices, specifically point number 6.

  2. Running php artisan config:cache is what fails if you pass new MyCoolStorageDriver. I think I could have made the classes serializable to make it work, but that seems very un-Laravel-y.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions