Open Closed

Force user logout after a certain period #6430


User avatar
0
devpayoff created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info:

  • ABP Framework version: v7.4.1
  • UI Type: Angular
  • Database System: EF Core
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

We want to manage the users session in such a way that after 20 minutes of inactivity a popup appears that asks the user if he wants to stay connected, if he doesn't press yes he will logout.

How can we do that?

Thank you

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

3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    There is an angular method to clear the login state.

    https://github.com/abpframework/abp/blob/dev/npm/ng-packs/packages/oauth/src/lib/utils/clear-o-auth-storage.ts#L4

    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

    devpayoff:

    I used: builder.SetAccessTokenLifetime(TimeSpan.FromMinutes(20)); for making the token expire after 20 minutes.
    
    In angular i subscribed to the token refresh expiration event so when the token expire a modal appear this.oAuthService.events .pipe(filter(event => event.type === 'token_refresh_error')) .subscribe(() => { this.modalVisible = true; }); 
    
    Problem is that when a token expire abp redirect me to login page. How can i remove/override that abp behavior?
    
    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

    Problem is that when a token expire abp redirect me to login page. How can i remove/override that abp behavior?

    I think the behavior comes from: https://github.com/abpframework/abp/blob/dev/npm/ng-packs/packages/oauth/src/lib/strategies/auth-flow-strategy.ts#L76-L78

    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 September 28, 2026, 11:44
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.