user3196479 user3196479 - 1 year ago 58
PHP Question

Lumen 5.4 Auth viaRequest $request-input returning null

For whatever reason, my AuthServiceProvider has stopped working. It looks like the $request parameter being passed to the closure for viaRequest is not seeing the request input. If I send JSON with a key of "access_token" to any of my endpoints and try and var_dump it in the closure - it only returns null. Here is the code for the boot method:

public function boot()
$this->app['auth']->viaRequest('api', function ($request) {

And here is my auth middlewares handle method:

public function handle($request, Closure $next, $guard = null)
if ($this->auth->guard($guard)->guest()) {
return response('Unauthorized.', 401);

return $next($request);

Any help is greatly appreciated since I am pulling my hair out right now.

EDIT Looks like the issue is with Sentry and their user_context setting be set to true. As soon as I set it to false, the requests come through perfectly

Answer Source

Issue turned out to be Sentry's user_context setting being set to true. Setting it to false fixed the issue.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download