Hello! I’m developing service on top of laravel 10 + php8.1. I’ve installed auth0 following this guide: Auth0 Laravel SDK Quickstarts: Add Login to a Laravel Application
Currently its “auth0/login”: “^7.9” installed in composer.
Since amount of users grows I’m getting big amount of Auth0\SDK\Exception\StateException: Invalid state exceptions logged on daily basis. I was able to reproduce this issue myself few times. It happens when you’re logged for a while and leave tab in background. Then when you open it back, sometimes it gets http 500 and this exception logged. Here’s the stack trace:
[stacktrace]
#0 /home/linktrust/linktrust/vendor/auth0/auth0-php/src/Auth0.php(187): Auth0\\SDK\\Exception\\StateException::invalidState()
#1 /home/linktrust/linktrust/vendor/auth0/login/src/Controllers/CallbackControllerAbstract.php(66): Auth0\\SDK\\Auth0->exchange()
#2 /home/linktrust/linktrust/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): Auth0\\Laravel\\Controllers\\CallbackControllerAbstract->__invoke()
#3 /home/linktrust/linktrust/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction()
During app page reload, auth0 catches and redirects user to the page:
https://linktrust.pro/callback?code=...&state=…
Which causes the error.
Can anyone help?