I have a Blazor Server app (.net5) that uses Microsoft.Identity.Web to sign users into AzureAD. This part of it all works as expected - load the app and it automatically gets the "Microsoft Signin" dialog. The AuthenticationStateTask also shows the user as "IsAuthenticated". My issue is trying to add a Sign Out button.
I have tried:
<a href="https://login.microsoftonline.com/common/oauth2/v2.0/logout">Log out</a>
and:
<a href="https://login.microsoftonline.com/{domainID}/oauth2/logout">Log Out</a>
Both take me to the Microsoft "hold on while we sign you out" page, the only difference being the first option asks "Which Account" to sign out from. Pressing "Back" in the browser or manually going to the site address again and i am automatically signed back in as the previous user. If i press "Log Out" and then manually go to:
/signout-oidc
i get a blank page (which i understand is correct) but then going back to the Wep App, i am correctly asked to log in again - so my assumption is the call back is is not being called automatically.
In my appsettings.json i have:
"CallbackPath": "/signin-oidc",
"SignedOutCallbackPath": "/signout-callback-oidc",
"RemoteSignOutPath": "/signout-oidc",
as well as the Domain and Tenant etc.
In the Azure Web Registration i have the /signout-oidc in the "Front-channel logout URL" field.
I must be missing something (or calling the wrong URL?) however after many hours of research, I cant work it out.
Any assistance on this would be greatly appreciated thank you.