stechstudio / filament-impersonate

Filament plugin that makes it easy to impersonate your users
250 stars 52 forks source link

Error 403 Forbidden when clicked from table actions #83

Open momostafa opened 3 months ago

momostafa commented 3 months ago

Hi,

When i click Impersonate from table actions I get Error 403 Forbidden I assume because the url stays the same mysite.test/admin/users When I click Impersonate from Edit view everything works normally

Laravel: 11.10.0 PHP 8.2.19 Filament: v3.2.86

Thanks for your help and support

use STS\FilamentImpersonate\Tables\Actions\Impersonate;

class UserResource extends Resource

            ->actions([
                Impersonate::make(),
                EditAction::make(),
                ActionGroup::make([
                    ViewAction::make(),
                    EditAction::make(),
                    DeleteAction::make(),
                    Impersonate::make(),
                ]),
            ])

config file

<?php
return [
    // This is the guard used when logging in as the impersonated user.
    'guard' => env('FILAMENT_IMPERSONATE_GUARD', 'web'),

    // After impersonating this is where we'll redirect you to.
    'redirect_to' => env('FILAMENT_IMPERSONATE_REDIRECT', '/admin'),

    // We wire up a route for the "leave" button. You can change the middleware stack here if needed.
    'leave_middleware' => env('FILAMENT_IMPERSONATE_LEAVE_MIDDLEWARE', 'web'),

    'banner' => [
        // Available hooks: https://filamentphp.com/docs/3.x/support/render-hooks#available-render-hooks
        'render_hook' => env('FILAMENT_IMPERSONATE_BANNER_RENDER_HOOK', 'panels::body.start'),

        // Currently supports 'dark', 'light' and 'auto'.
        'style' => env('FILAMENT_IMPERSONATE_BANNER_STYLE', 'dark'),

        // Turn this off if you want `absolute` positioning, so the banner scrolls out of view
        'fixed' => env('FILAMENT_IMPERSONATE_BANNER_FIXED', true),

        // Currently supports 'top' and 'bottom'.
        'position' => env('FILAMENT_IMPERSONATE_BANNER_POSITION', 'top'),

        'styles' => [
            'light' => [
                'text' => '#1f2937',
                'background' => '#f3f4f6',
                'border' => '#e8eaec',
            ],
            'dark' => [
                'text' => '#f3f4f6',
                'background' => '#1f2937',
                'border' => '#374151',
            ],
        ]
    ],
];
user3470 commented 1 month ago

It's not redirecting after impersonating resulting in a Forbidden Error

koppa53 commented 1 month ago

I'm having the same issue anyone got a solution ?