Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

michaelnguyen547's avatar

can not get Horizon dashboard authorization work

Horizon has new Dashboard Authorization using Gate. I set env to production, and return true inside gate. I get 403 when accessing Horizon, which I don't understand, the gate should allow me to get in.

/**
 * Register the Horizon gate.
 *
 * This gate determines who can access Horizon in non-local environments.
 *
 * @return void
 */
protected function gate()
{
    Gate::define('viewHorizon', function ($user) {
    return true; // still get 403
    });
}

what do I miss?

0 likes
4 replies
D9705996's avatar

Do you have an authenticated user? IIRC you need to be authenticated as well as passing the gate condition

michaelnguyen547's avatar

@d9705996 Thanks for pointing that out. I test with a fresh L5.7 app and it works. I am using multi-auth (https://github.com/Hesto/multi-auth) in my app and it definitely interfere with Horizon gate.

The $request->user() return null and I don't know why

vendor/laravel/horizon/src/HorizonApplicationServiceProvider.php
    /**
     * Configure the Horizon authorization services.
     *
     * @return void
     */
    protected function authorization()
    {
        $this->gate();

        Horizon::auth(function ($request) {
            return app()->environment('local') ||
                   Gate::check('viewHorizon', [$request->user()]);
        });
    }

Please or to participate in this conversation.