-
Description:The current redirects in Impersonation can be used to impersonate the user using a client outside the Nova UI and it is a common use case to want to see as the user would on the application itself and not just the Nova instance. Nova works perfectly for this in conjunction with Sanctum sessions -- outside the hardcoded redirect. The current hardcoded routes result in a broken redirect -- especially likely when using Laravel / Nova in conjunction with a SPA/PWA. These hardcoded URLs set to I have implemented the second more robust option for my own use as a patch to the nova package which solves my challenge, but it really should be a core standard behavior so that others don't face the same issue. I would consider the current behavior a bug given it breaks the implementation intention. I should note that you can put a redirect on the web route for Detailed steps to reproduce the issue on a fresh Nova installation:Use a SPA or non-Laravel provided client side so that there is nothing located at the '/' for the Laravel instance. Impersonate a user. Change the hard-coded URLs in \Laravel\Nova\Http\Controllers\ImpersonateController, repeat the same process, and the redirect will work as the end developer intends. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Digging around a bit more -- appears some of these routes can already be overwritten to some extent via undocumented config properties (At least I didn't find it in the documentation):
These still assume a base nova path which may not be conducive when |
Beta Was this translation helpful? Give feedback.
-
Update to 4.14.0 and add the following configuration to /*
|--------------------------------------------------------------------------
| Nova Impersonation Redirection URLs
|--------------------------------------------------------------------------
|
| This configuration option allows you to specify a URL where Nova should
| redirect an administrator after impersonating another user and a URL
| to redirect the administrator after stopping impersonating a user.
|
*/
'impersonation' => [
'started' => '/',
'stopped' => '/',
], You should also be able to configure redirection on runtime using the following: https://nova.laravel.com/docs/4.0/customization/impersonation.html#impersonation-events |
Beta Was this translation helpful? Give feedback.
Update to 4.14.0 and add the following configuration to
config/nova.php
:You should also be able to configure redirection on runtime using the following:
http…