Ah, got it! I needed to pass along my custom guard:
$request->user('my-custom-auth');
So I am a bit puzzled by the following: I have a custom authentication guard set up for my Lumen app using
$this->app['auth']->viaRequest('my-custom-aut' ...
I am definitely returning a user from it as in Authenticate.php the line
$this->auth->guard($guard)->guest()
returns false and I reach my controller method just fine. Also dd($user) in AuthenticationProvider.php (just before the return) dumps the right user instance. However, when I try to fetch the user using request->user() either in Authenticate.php or my controller method the result is always null... How can this be?
I am suspecting that perhaps it has to do with the fact that I use a different $primaryKey for my User model and perhaps this isn't reflected correctly in the $request->user() call.
I'm going to dd() my way through $request->user() to find out, but perhaps someone knows right away what is going on. Maybe I am missing something.
Thanks,
Mikey
Ah, got it! I needed to pass along my custom guard:
$request->user('my-custom-auth');
Please or to participate in this conversation.