-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Octane + OpenSwoole: Auth::user() only works on first request #222
Comments
After doing some diggin, I realised If I create my own middleware, it works. I'm not convinced its the best way forward though:
|
same to me |
did you figure out a solution? @Ctrl-Mota @leonvd6 |
@rajathans No still using my code above to get around it. |
@leonvd6 do you have any global scopes within your auth model? |
Hi @leoralph , No global scopes on my model but thanks for the detailed feedback. I must say my solution above has been rock solid so far. |
Subject of the issue
I've migrated my environment to Octane+Swoole and when making a request with
jwt.auth
middleware inapi.php
, the user is found usingAuth::user()
or$request->user()
, but the subsequent request returnnull
.Your environment:
Steps to reproduce
dd(Auth::user())
in a controller API request twice in a row. Runningphp artisan octane:reload
fixes the issue for the next request only.Expected behaviour
Auth::user()
should return the user object on every request, not just the first one.Actual behaviour
Auth::user()
returns a user on the first request, then null on any requests after that.The text was updated successfully, but these errors were encountered: