Internal Requests - Access authenticated user outside of controller
- Dominant language
- PHP
- Stars
- 9.4k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I'm using Dingo's Internal Requests, specifying which user to authenticate as (API::be($user)), and this works well for Dingo's auth middleware as well as for my controllers... but I cannot access the user info anywhere outside of the controller as far as I can tell.
I need to access the user in both a middleware and a model observer. I've tried Auth::user(), request()->user(), $request->user(), etc, but it all returns null. These all return the user when making a regular request through a Dingo API route, just not when spoofing the user through the Internal Requests dispatcher.
Any thoughts? For clarification, I'm using Dingo's built-in jwt.auth support for authentication.
Thanks.
Contributor guide
Assessment
This issue has not been assessed yet.