\n
logout() {\n var account = this.authService.instance.getAllAccounts()[0];\n let logoutRequest:EndSessionRequest = {\n account: account\n };\n \n this.authService.logout(logoutRequest);\n }\n<\/pre>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\nWhen using Microsoft Identity Web or AspNet (Core) OpenIdConnect Authentication<\/p>\n\n\n\n
services.Configure<OpenIdConnectOptions>(OpenIdConnectDefaults.AuthenticationScheme, options =>\n\n{\n\n \/\/ Custom code here.\n options.Events.OnRedirectToIdentityProviderForSignOut = (context) =>\n\n {\n\n var login_hint = context.HttpContext.User.Claims.Where(c => c.Type == \"login_hint\").FirstOrDefault();\n\n if (login_hint != null)\n\n {\n\n context.ProtocolMessage.SetParameter(\"logout_hint\", login_hint.Value);\n\n };\n\n return Task.FromResult(true);\n\n };\n\n});<\/pre>\n","protected":false},"excerpt":{"rendered":"By default, when you sign out of Azure Active Directory when using a Open ID Connect\/OAuth2 application, you will be prompted to select a user account to sign out of, even if there is only one user account to select. To work around this behavior, there are 3 requirements: Step (1): Add the optional claim for the login_hint Add the login_hint optional claim to the id token in the App…<\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,5,261],"tags":[17,263,264,158],"class_list":["post-8711","post","type-post","status-publish","format-standard","hentry","category-authentication","category-azure-ad","category-logout","tag-aad","tag-logout","tag-oauth2","tag-oidc"],"_links":{"self":[{"href":"https:\/\/blogs.aaddevsup.xyz\/wp-json\/wp\/v2\/posts\/8711"}],"collection":[{"href":"https:\/\/blogs.aaddevsup.xyz\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.aaddevsup.xyz\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.aaddevsup.xyz\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.aaddevsup.xyz\/wp-json\/wp\/v2\/comments?post=8711"}],"version-history":[{"count":6,"href":"https:\/\/blogs.aaddevsup.xyz\/wp-json\/wp\/v2\/posts\/8711\/revisions"}],"predecessor-version":[{"id":9275,"href":"https:\/\/blogs.aaddevsup.xyz\/wp-json\/wp\/v2\/posts\/8711\/revisions\/9275"}],"wp:attachment":[{"href":"https:\/\/blogs.aaddevsup.xyz\/wp-json\/wp\/v2\/media?parent=8711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.aaddevsup.xyz\/wp-json\/wp\/v2\/categories?post=8711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.aaddevsup.xyz\/wp-json\/wp\/v2\/tags?post=8711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}