Issue:

Authenticate state does not update after login when in main layout page, therefore IsInRole function does not work.

Workaround:

Force the browser to refresh.

            // Workaround for login state not updating when first login.
            if (!authenticationState.User.Identity.IsAuthenticated && NavigationManager.Uri.Contains("/authentication/login-callback") && treedata.Count() == 1)
            {
                NavigationManager.NavigateTo("/", forceLoad: true);
            }
Last modified: December 27, 2020

Author

Comments

Write a Reply or Comment