Git Product home page Git Product logo

Comments (7)

MarJose123 avatar MarJose123 commented on May 25, 2024

image

I have two guards, admin and the default web. When I'm trying to impersonate an admin as a default user, I'm getting this issue.

What I'm doing wrong? If you need more information, please, let me know, and I'll share you what you need.

Thanks in advance!

Did you add the traits to our authenticable model?

from filament-impersonate.

gboquizosanchez avatar gboquizosanchez commented on May 25, 2024

Yeah, and not working.

use Lab404\Impersonate\Models\Impersonate;

final class Admin extends Authenticatable implements FilamentUser, MustVerifyEmail
{
    use Impersonate;
    
    ...
}

---

use Lab404\Impersonate\Models\Impersonate;

final class User extends Authenticatable implements FilamentUser, MustVerifyEmail
{
    use Impersonate;
    
    ...
}

Do you mean this, right?

from filament-impersonate.

MarJose123 avatar MarJose123 commented on May 25, 2024

how about in your filament panel? did you declare the guard should be used?

and can you add this to your authenticable

public function canImpersonate(): bool
{
    return true;
}

from filament-impersonate.

gboquizosanchez avatar gboquizosanchez commented on May 25, 2024

I'm logged as "admin":

public function panel(Panel $panel): Panel
{
    return $panel
        ->authGuard('admin')
        ...
}

and my impersonate button is like:

Impersonate::make('impersonate')
    ->guard('web')
    ->link()
    ->iconSize(IconSize::Small)

I need to change something in laravel-impersonate config?

canImpersonate is automatically established as true.

from filament-impersonate.

MarJose123 avatar MarJose123 commented on May 25, 2024

I'm logged as "admin":

public function panel(Panel $panel): Panel
{
    return $panel
        ->authGuard('admin')
        ...
}

and my impersonate button is like:

Impersonate::make('impersonate')
    ->guard('web')
    ->link()
    ->iconSize(IconSize::Small)

I need to change something in laravel-impersonate config?

canImpersonate is automatically established as true.

I'm not quit sure now what is the cause of issue you encountered, there is no needed really to change in the config file, maybe you need to revisit the README file and check on what steps you missed and if you are caching you laravel you need to clear it.

from filament-impersonate.

gboquizosanchez avatar gboquizosanchez commented on May 25, 2024

At last, I have achieved the way to impersonate the user. But, when I put the banner component, I got this message:

image

But in debugbar the user is logged, but the admin is logged out, so, I don't know what it's happening...

from filament-impersonate.

gboquizosanchez avatar gboquizosanchez commented on May 25, 2024

I just found the issue...

The problem was, I was redirecting impersonated user to a route without 'web' middleware. :(

I made my site with Folio laravel, and by default is not set.

Thanks for your help :)

from filament-impersonate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.