Session Expiry Issue with Google Login in Duende IdentityServer #80
Replies: 8 comments 4 replies
-
Assuming that you mean IdentityServer's session (not the client's session): The code where the session cookie is set for internal logins and where it is set for external logins is not in the IdentityServer library. It is part of your project. When using our template code look for Pages/Account/Login to find the code for the internal login and in Pages/ExternalLogin/Callback.cshtml.cs for external. Also: What is the lifetime of the Google session? If that is shorter with |
Beta Was this translation helpful? Give feedback.
-
Currently i am configured the cookie using the ConfigureApplicationCookie than i am facing the issue of Earlier logout When using the External Provider ( Google ) over the Passowrd Auth flow. And as per the suggestion there is not diffrence in logic of pages ( Login and Callback ) So for the same session time of external and local login do i need to configure both cookies IdentityServer and Application Cookie? |
Beta Was this translation helpful? Give feedback.
-
When using an external authentication provider (Google in this case) there are at least 3 sessions:
These all set their own session cookies and thus can have their own session lifetime. So the solution could be one of these:
|
Beta Was this translation helpful? Give feedback.
-
As per your suggestion i Removed the ForwardSignout Property and tested but still faces same issue. Now further the finding i found that i need to configure the both cookies Identity Server Cookie and Application Cookies. so, i configured both with same expiry time but and test the application but that is not helped me in my case. is there possible that i miss some Client Configuration for this issue? if you can suggest the What configuration i need to do for the same session time for both External and Local login ( Password )? |
Beta Was this translation helpful? Give feedback.
-
Can you please share the code that runs when the callback from the external identity provider takes place? |
Beta Was this translation helpful? Give feedback.
-
Sure here is the OnGet method of the Callback page: public async Task OnGet()
} |
Beta Was this translation helpful? Give feedback.
-
@AbhiEVision do you have an Enterprise license with access to priority support? We may need some extra information here to help diagnose and determine if this may needs some consulting. |
Beta Was this translation helpful? Give feedback.
-
I have observed that if i have not configured any cookies and its time and only configured the Serverside Sessions as per the demo my session is not getting expired earlier as per the expectations. session time is shown as 14 days so I need help that how can I decrease time of session. Also i need to know that custom implementation of IAuthorizeInteractionResponseGenerator, IProfileService and ICustomAuthorizeRequestValidator interface can affect the session time or not? |
Beta Was this translation helpful? Give feedback.
-
IdentityServer version
6.3.10
.NET version
6
Description
Issue
I am using Duende IdentityServer with Google as an external identity provider. My login flow includes:
Password Flow (which works fine)
Google Login Flow (session expires too soon)
When logging in using the password flow, the session remains valid as expected. However, when logging in via Google, the session expires much sooner than the configured lifetime settings.
Client Configuration:
IdentityTokenLifeTime: 300
AccessTokenLifeTime: 1200
AuthorizationCodeLifeTime: 300
AbsoluteRefreshTokenLifeTime: 604800 (7 Days)
RefreshTokenUsage: OneTimeOnly
RefreshTokenExpiration: Absolute
Server-Side Cookie Configuration:
Cookie Lifetime: 1 Day
Sliding Expiration: True
Google External Authentication Configuration:
Actual Behavior
Password flow works as expected.
Google login flow causes session expiration much earlier than configured, forcing frequent re-authentication.
Questions
What could be causing the session to expire earlier when logging in via Google?
Are there additional settings required to persist the session for external providers like Google?
Is there a difference in how IdentityServer handles sessions for external vs. local logins?
Any guidance or suggestions would be greatly appreciated!
Reproduction steps
No response
Expected behavior
The session should persist according to the configured cookie and token lifetimes for both Password and Google login flows.
Logs
No response
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions