Server Side Session SQL Database #98
-
IdentityServer version7 .NET version9 DescriptionWe have setup server side sessions and have a single session database accessed by two different apps. Is this possible or does each app need its own session database? Reproduction stepsNo response Expected behaviorNo response LogsNo response Additional contextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
If you use the OpenID Connect authorization code flow in system browser that shares cookies (ASWebAuthenticationSession on iOS, CustomTab on Android), you can have one serverside session in browser, and authorize the two mobile app clients with each their refresh_token. The two refresh_tokens belongs to the same serverside session. |
Beta Was this translation helpful? Give feedback.
-
I understand the shared cookies across both apps and yes indeed the same cookies are shared I can view them via the browser. To further describe the scenario we have the Backend For Front End framework in place and the call to /bff/user?slide=false fails on the 2nd app to login. If I refresh either app they are both still logged in and authenticated. The entries from the log of the app that fails to call /bff/user is as follows: -
These logs are from our local development environment but we get similar behaviour when deployed to Azure App Services. The only difference being that when we run locally we get 2 server sessions because the ApplicationName is different where as on the live database there is only ever one because the application name appears to be identical for both apps. We have the server side sessions enabled via the AddEntityFrameworkServerSideSessions extension method and we use the same connection string in both our apps. Our BFF configuration it is as follows in both app projects: -
|
Beta Was this translation helpful? Give feedback.
-
OK after more hours of digging and running the SQL profiler I'm not sure this is an issue with the session store, although when you have two web apps running concurrently in Visual Studio you only ever get requests to the Session Store for the second app to login. I cannot find anyway to configure the application discriminator to overcome this. |
Beta Was this translation helpful? Give feedback.
-
I realized that my cookie in both apps had the same name due to the code being shared between both apps!!
I've now given each app it's own name and everything is working as it should, sorry nothing to do with Duende! |
Beta Was this translation helpful? Give feedback.
I realized that my cookie in both apps had the same name due to the code being shared between both apps!!
I've now given each app it's own name and everything is working as it should, sorry nothing to do with Duende!