If you've been following the instructions in the section "Installing Only In Specific Environments" you'll need to ensure that you update your AppServiceProvider
accordingly, e.g.
public function register()
{
if ($this->app->environment('local') || $this->app->environment('staging')) {
$this->app->register(TelescopeServiceProvider::class);
}
}
The problem appears to be the following method in TelescopeApplicationServiceProvider
:
/** * 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()]); }); }
I overrode this method in my TelescopeServiceProvider
and defined my own auth closure (add this function to app/Providers/TelescopeServiceProvider.php
):
/** * Configure the Telescope authorization services. * * @return void */ protected function authorization() { $this->gate(); Telescope::auth(function ($request) { return app()->environment(['local', 'staging']) || Gate::check('viewTelescope', [$request->user()]); }); }
This allowed me to access telescope in my staging environment. I tried changing my gate()
override and it didn't appear to work. This was the only way that I could reliably get it to work.