You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: support/entra/entra-id/app-integration/customize-authentication-session-expiration.md
+14-15Lines changed: 14 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,20 @@
1
1
---
2
2
title: Configure ASP.NET or ASP.NET Core App Session to Last Longer Than Entra ID Tokens
3
-
description: Describes how to configure ASP.NET or ASP.NET Core App session to last longer than Microsoft Entra ID token.
3
+
description: Discusses how to configure ASP.NET or ASP.NET Core App session to last longer than Microsoft Entra ID token.
4
4
ms.date: 05/31/2025
5
5
ms.reviewer: willfid
6
6
ms.service: entra-id
7
7
ms.custom: sap:Developing or Registering apps with Microsoft identity platform
8
8
---
9
-
# Customize Middleware authentication ticket to extend user sign-in duration
9
+
# Customize middleware authentication ticket to extend user sign-in duration
10
10
11
-
Microsoft Entra ID tokens (ID tokens, access tokens, and SAML tokens) by default expire after one hour. ASP.NET and ASP.NET Core Middleware set their authentication ticket to the expiration of these tokens by default. If you don't want your web application to redirect users to Microsoft Entra ID to sign in again, you can customize the Middleware authentication ticket.
11
+
By default, Microsoft Entra ID tokens (ID tokens, access tokens, and SAML tokens) expire after one hour. Also by default, ASP.NET and ASP.NET Core middleware set their authentication tickets to the expiration of these tokens. If you don't want your web application to redirect users to Microsoft Entra ID to have them sign in again, you can customize the middleware authentication ticket.
12
12
13
13
This customization can also help resolve AJAX issues (such as CORS errors to `login.microsoftonline.com`) where your app is both a Web App and Web API.
14
14
15
15
## For ASP.NET
16
16
17
-
In the `ConfigureAuth` method of your`Startup.Auth.cs` file, update the `app.UseCookieAuthentication()` method to:
17
+
In the `ConfigureAuth` method of the`Startup.Auth.cs` file, update the `app.UseCookieAuthentication()` method to:
@@ -207,10 +207,9 @@ public void ConfigureServices(IServiceCollection services)
207
207
```
208
208
## More information
209
209
210
-
These settings control the expiration of the authentication ticket, whichdetermineshowlongauserstayssignedin. Youcanconfigurethisexpirationtosuityourrequirement.
210
+
These settings control the expiration of the authentication ticket that determines how long a user stays signed in. You can configure this expiration to suit your requirement.
211
211
212
-
>[!NOTE]
213
-
>Ifyoumodifytheticketexpiration, usersmaystillhaveaccesstoyourapplicationevenifthey've been deleted or disabled in Microsoft Entra ID, until the ticket expires.
212
+
>[!NOTE]
213
+
> If you modify the ticket expiration, usersmaystillhaveaccesstoyourapplicationevenifthey've been deleted or disabled in Microsoft Entra ID,. This condition remains true until the ticket expires.
0 commit comments