© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•9mo ago•
3 replies
Aivirth

Issue with ExportAction error 403

I'm trying to setup an export for a resource, i managed to follow the documentation and solve the issues caused by the fact i have 3 tables which can authenticate on the system (sadly it's a legacy thing and I can't change it).
I reached the point where the file is created but when i try to download it i always get error 403, i think the issue is caused by the fact that it doesn't recognize the Admin model as the current Auth user or is that it doesn't recognize the
/filament/exports/{export}/download
/filament/exports/{export}/download
route as being under filament
i tried to override it through a custom middleware but it's still not working.

Route::get('/filament/exports/{export}/download', DownloadExport::class)
    ->name('filament.exports.download')
    ->middleware([FilamentAccess::class]);
Route::get('/filament/exports/{export}/download', DownloadExport::class)
    ->name('filament.exports.download')
    ->middleware([FilamentAccess::class]);


class FilamentAccess
{
    /**
     * Handle an incoming request.
     *
     * @param  \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response)  $next
     */
    public function handle(Request $request, Closure $next): Response
    {
        if (! Filament::auth()->check()) {
            return redirect()->route('filament.admin.auth.login');
        }

        /** @var \App\Models\Admin */
        $user = Filament::auth()->user();

        if (! $user || !($user instanceof \App\Models\Admin)) {
            abort(403, 'You do not have access to the admin panel.');
        }

        return $next($request);
    }
}
class FilamentAccess
{
    /**
     * Handle an incoming request.
     *
     * @param  \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response)  $next
     */
    public function handle(Request $request, Closure $next): Response
    {
        if (! Filament::auth()->check()) {
            return redirect()->route('filament.admin.auth.login');
        }

        /** @var \App\Models\Admin */
        $user = Filament::auth()->user();

        if (! $user || !($user instanceof \App\Models\Admin)) {
            abort(403, 'You do not have access to the admin panel.');
        }

        return $next($request);
    }
}
Solution
Apparently all I had to do was using the auth:admin middleware
Route::get('/filament/exports/{export}/download', DownloadExport::class)
    ->name('filament.exports.download')
    ->middleware([
        'web', 'auth:admin',
       FilamentAccess::class
    ]);
Route::get('/filament/exports/{export}/download', DownloadExport::class)
    ->name('filament.exports.download')
    ->middleware([
        'web', 'auth:admin',
       FilamentAccess::class
    ]);
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

ExportAction with MInIO
FilamentFFilament / ❓┊help
2y ago
ExportAction problem
FilamentFFilament / ❓┊help
2y ago
Issue with ExportAction on table with defaultSort() on a relationship attribute
FilamentFFilament / ❓┊help
2y ago
Error 403 Forbiden
FilamentFFilament / ❓┊help
7mo ago