Reputation: 581
I could not achieve single signout from all clients in angular. The code I used is on below. The logout function is calling from angular app and signoff from the current application but it is not signout from all client (other angualr applications which is using the same identity server)
Please help me to achieve signout from all clients. Thanks in Advance
IdentityServer4 configuration of the client
new Client
{
//testing logout
ClientId = "clientangularSLO",
ClientName = "Angular Client",
AllowedGrantTypes = GrantTypes.Code,
RequireClientSecret = false,
AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"api1",
"roles"
},
RedirectUris = new List<string> {"http://localhost:4300"},
PostLogoutRedirectUris = new List<string> {"http://localhost:4300"},
AllowedCorsOrigins = new List<string> {"http://localhost:4300" },
RequireConsent= false,
RequirePkce = true,
AllowAccessTokensViaBrowser = true,
AllowOfflineAccess = true
}
Angular OIDC Configuration
oidcConfigService.withConfig({
stsServer: 'https://localhost:4001',
redirectUrl: window.location.origin,
clientId: 'clientangularSLO',
scope: 'openid profile',
responseType: 'code',
triggerAuthorizationResultEvent: true,
postLogoutRedirectUri: `${window.location.origin}/unauthorized`,
logLevel: LogLevel.Debug,
historyCleanupOff: true,
});
Angular Logout Code
import { OidcSecurityService } from 'angular-auth-oidc-client';
constructor(private oidcSecurityService: OidcSecurityService, private router: Router, private route: ActivatedRoute){}
logout() {
this.oidcSecurityService.logoff();
}
Upvotes: 4
Views: 1185