Skip to content

Instantly share code, notes, and snippets.

@FacileTechnolab
Created December 22, 2023 10:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FacileTechnolab/83037ccc9486da1b84a54fb01c54ca8c to your computer and use it in GitHub Desktop.
Save FacileTechnolab/83037ccc9486da1b84a54fb01c54ca8c to your computer and use it in GitHub Desktop.
Login and Logout links
<!-- Add @using Microsoft.AspNetCore.Components.Authorization at the top-->
<CascadingAuthenticationState>
<AuthorizeView>
<Authorized>
<a asp-controller="Home" asp-action="Index">Welcome @context.User.Identity?.Name!</a>
<a href="MicrosoftIdentity/Account/SignOut">Logout</a>
</Authorized>
<NotAuthorized>
<a href="MicrosoftIdentity/Account/SignIn">Login</a>
</NotAuthorized>
</AuthorizeView>
</CascadingAuthenticationState>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment