emonney / QuickApp

ASP.NET Core / Angular startup project template with complete login, user and role management. Plus other useful services for Quick Application Development
https://www.ebenmonney.com/quickapp
MIT License
1.26k stars 594 forks source link

Error when Session expires #88

Closed bDino closed 5 years ago

bDino commented 6 years ago

Hey guys,

im getting an error when the session expires. Not sure where its thrown. So the login modal gets shown after the defaultLogger catches the exception and displays the default console.error message.

Am I doing something wrong?

EDIT: error comes from vendor.js?v=wFO_StllaIYdeQahLtkXG1EkAO0gvHEBZudohchR06Q:147646 POST http://localhost:51670/connect/token 400 (Bad Request)

EDIT 2: Error message is thrown in the general error handler: if (confirm("Fatal Error!\nAn unresolved error has occured. Do you want to reload the page to correct this?\n\nError: " + error.message)) window.location.reload(true);

EDIT 3: It's kind of a weird behaviour - not authorized gets thrown but when the request fires a second time it passes through and the data gets loaded. The login Modal still appears.

every time when the session expires. Anyway i can comment that out. Is there a place a can specify how long a session is valid?

emonney commented 5 years ago

Yes. You can the lifetime of the access token from Startup.cs in ConfigureServices(). E.g.

     services.AddOpenIddict()
                .AddServer(options =>
                {
                    options.SetAccessTokenLifetime(TimeSpan.FromHours(24));
                ...

Note the relevant code is options.SetAccessTokenLifetime(TimeSpan.FromHours(24));