Laravel Telescope - 403 Forbidden
By default, you will only be able to access this dashboard in the local
environment.
Within your app/Providers/TelescopeServiceProvider.php
file, there is a gate
method. This authorization gate controls access to Telescope in non-local environments. You are free to modify this gate as needed to restrict access to your Telescope installation:
/** * Register the Telescope gate. * * This gate determines who can access Telescope in non-local environments. * * @return void */protected function gate(){ Gate::define('viewTelescope', function ($user) { return in_array($user->email, [ // Your users 'user@yourapp.tld', ]); });}
You may override authorization()
method in Laravel\Telescope\TelescopeApplicationServiceProvider
in your App\Providers\TelescopeServiceProvider
and include your enviroment name.
But be careful with it.
/** * Configure the Telescope authorization services. * * @return void */protected function authorization(){ $this->gate(); Telescope::auth(function ($request) { return app()->environment('local') || Gate::check('viewTelescope', [$request->user()]); });}
to
...return app()->environment(['local', testing]) || Gate::check('viewTelescope', [$request->user()]);...