I'm trying to do a v14 version of my Impersonator package, and I've gotten pretty far. Created the necessary controllers, and added an entity action to the user workspace, for starting the impersonation of a user.
The idea is, that you click "Impersonate" on a user profile, which then calls an API controller, that finds the user, signs out the current backoffice user (using the IBackofficeSignInManager), and then signs the new user in. This was how it worked in the previous versions too.
I've debugged the controller, it gets hit, and returns success, so I guess the signing in through IBackofficeSigninManager goes as expected. But when I reload the backoffice afterwards, the original user is still signed in instead of the one I'm trying to impersonate.
I guess I have to do something in the client side files to update access tokens etc.
Anyone can shed a light on what I miss?
The code is up at
https://github.com/skttl/umbraco-impersonator/tree/v3/dev
Interesting parts:
The Impersonate controller method, that signs the current user out, and the impersonated user in:
https://github.com/skttl/umbraco-impersonator/blob/v3/dev/src/Our.Umbraco.Impersonator/Our.Umbraco.Impersonator.Core/Controllers/UserController.cs#L96
The Impersonate entity action that asks the impersonatorContext to impersonate the selected user:
https://github.com/skttl/umbraco-impersonator/blob/v3/dev/src/Our.Umbraco.Impersonator/Our.Umbraco.Impersonator.Client/assets/src/actions/entity/impersonate.action.ts
The impersonate method in the impersonatorContext, that sends the request to the API controller and handles the response:
https://github.com/skttl/umbraco-impersonator/blob/v3/dev/src/Our.Umbraco.Impersonator/Our.Umbraco.Impersonator.Client/assets/src/context/impersonator.context.ts#L78