SSO not working for IdentityModel.OidcClient

566 Views Asked by At

I am adding OIDC login to a WinForms application. I set up the application using the IdentityModel.OidcClient library and pulled the boilerplace code from their WinForm Sample. The OIDC successfully shows the login form, does MFA, and I get back the tokens.

However, if I close the application and open it again, I have to authenticate again. Usually, the SSO session in the browser allows me to bypass this step. It seems the OidcClient is using a browser session that gets destroyed when the application closes and is not shared between applications.

How can I configure my application to use the SystemBrowser or another browser that will maintain those SSO cookies between executions and/or for different applications that use this component.

Thanks in advance.

1

There are 1 best solutions below

4
Tore Nestenius On

First thing to check is that the session cookie that you set have an expire date in the future, otherwise it will just be a cookie that will last this browser session.

In your browser you can see that in the developer tools section, like in this example:

enter image description here

Alternatively, you can use a tool like Fiddler to check the response that sets the session cookie and make sure it contains a future expire date.

You can configure that in your ASP.NET application.