You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my blazor webassembly project i am trying to load poilicies from webapi, so that admins can set policies(permissions) for each roles.
The problem is that the Authorization policy validation on the first page is done even before getting the response from httpclient request as it is async call, and i get an error the policy does not exists.
Is there any way that i can execute httpclient request synchronously OR check if the policy exists and wait till policy initialization is complete.
If i try to load the above page directly i get the error: crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: The AuthorizationPolicy named: 'FinanceTransaction' was not found
But if i wait for policy initialization and navigate to other pages everything would work fine.
Can any one help me to resolve the issue. Or is there any other better approach for this
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In my blazor webassembly project i am trying to load poilicies from webapi, so that admins can set policies(permissions) for each roles.
The problem is that the Authorization policy validation on the first page is done even before getting the response from httpclient request as it is async call, and i get an error the policy does not exists.
Is there any way that i can execute httpclient request synchronously OR check if the policy exists and wait till policy initialization is complete.
JSON Object:
Policy Initialization:
Razor Page:
If i try to load the above page directly i get the error:
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: The AuthorizationPolicy named: 'FinanceTransaction' was not found
But if i wait for policy initialization and navigate to other pages everything would work fine.
Can any one help me to resolve the issue. Or is there any other better approach for this
Beta Was this translation helpful? Give feedback.
All reactions