- ABP Framework version: v4.3.3
- UI type: Angular
- DB provider: MongoDB
- Tiered (MVC) or Identity Server Separated (Angular): yes
I would like to logout current user.
I use for it await SignInManager.SignOutAsync();
Also try this await SignInManager.Context.SignOutAsync();
But nothing happened. When refreshing browser page, user is still login in system. Why? How do proper logout?
5 Answer(s)
-
0
Hi @dev1.abp.advantiss, can you try the below code:
public IdentitySecurityLogManager IdentitySecurityLogManager {get;set;} public AbpSignInManager SignInManager {get; set;} //or //public SignInManager<IdentityUser> SignInManager { get; set; } await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext() { Identity = IdentitySecurityLogIdentityConsts.Identity, Action = IdentitySecurityLogActionConsts.Logout }); await SignInManager.SignOutAsync();
-
0
Hi @dev1.abp.advantiss, can you try the below code:
public IdentitySecurityLogManager IdentitySecurityLogManager {get;set;} public AbpSignInManager SignInManager {get; set;} //or //public SignInManager<IdentityUser> SignInManager { get; set; } await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext() { Identity = IdentitySecurityLogIdentityConsts.Identity, Action = IdentitySecurityLogActionConsts.Logout }); await SignInManager.SignOutAsync();
Nothing is happened. After this code I check
CurrentUser.IsAuthenticated
and it's stilltrue
. -
0
But nothing happened. When refreshing browser page, user is still login in system.
Do you mean Angular app still have the state?
-
0
But nothing happened. When refreshing browser page, user is still login in system.
Do you mean Angular app still have the state?
Yes
-
0
hi
Angular and Identity Server are two separate sites you can try to log out from the angular app.