Closed AlexKratky closed 1 week ago
Okay, I figured it out, it seems the problem is because laravel fails to properly load non-cached configuration, so running php artisan config:cache
solves this problem. Of course that the cache command should be used on production and not on local env. It would be nice to somehow handle this, but I found that other libs has similar issue but not so often, so its bug with laravel itself.
Sanctum Version
4.0.3
Laravel Version
11.28.1
PHP Version
8.2.12
Database Driver & Version
No response
Description
Sometimes, when I send more requests in short period of time (talking about 3 to 10 requests per seconds), I sometimes receive error 401, even though that token is presented, its same as request before or after (and the request before or after passes). I did not find any info about this behavior, so I assuming its some kind of bug. I do have any throttling and even if there is some hidden, the error would be 429. I also tried switching to cookie authentication, but the problem is still the same.
Steps To Reproduce
just call any route under sanctum, for this scenario I use simple test:
setTimeout(() => { for (let i = 0; i <= 50; i++) { setTimeout(() => fetch(...), 50 * i) }
},5000)