Open Closed

User logout doesn't work #2377


User avatar
0
dev1.abp.advantiss created
  • 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?

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

5 Answer(s)
  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    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();
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    dev1.abp.advantiss created

    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 still true.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    But nothing happened. When refreshing browser page, user is still login in system.

    Do you mean Angular app still have the state?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    dev1.abp.advantiss created

    But nothing happened. When refreshing browser page, user is still login in system.

    Do you mean Angular app still have the state?

    Yes

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Angular and Identity Server are two separate sites you can try to log out from the angular app.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 05, 2026, 11:32
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.