Fix Blazor WebApp back to impersonator not using form post #21675
BackSummary
Fixes #21668 - Blazor WebApp - Returning back after impersonation gets an error.
Root Cause
The impersonatorMenuItem variable was null after adding a new menu item in AccountBlazorUserMenuContributor.cs, so UseComponent<ImpersonationComponent>() was never called. This caused the "Back to my account" button to do a GET request instead of POST, resulting in the "client_id is missing" error from OpenIddict.
Fix
Store the newly created menu item in the impersonatorMenuItem variable before adding it to the menu, then call UseComponent<ImpersonationComponent>() on it.
Changes
abp/account/src/Volo.Abp.Account.Pro.Public.Blazor.Shared/AccountBlazorUserMenuContributor.cs
How to test?
Option A
- Convert your existing project to local referrence and it'll be working
Option B
- Create a project with Local Reference and it'll be working