How to get a very long and renewable connection ?
Hello,
I would like to have a very long and renewable connection in order to never be disconnected even after 1 month of inactivity on my browser.
What would be the client configuration required to achieve this result?
My current configuration is as follows:
new Client
{
ClientId = "spa",
ClientName = "SPA Client",
RequireConsent = false,
IdentityTokenLifetime = 86400, // one day.
AccessTokenLifetime = 1296000, // 15 days.
ClientUri = $"{configuration.GetValue<string>("Clients:SPAClientUri")}",
AllowedGrantTypes = GrantTypes.Code,
RequirePkce = true,
RequireClientSecret = false,
AllowAccessTokensViaBrowser = true,
RedirectUris =
{
$"{configuration.GetValue<string>("Clients:SPAClientUri")}/auth-callback",
$"{configuration.GetValue<string>("Clients:SPAClientUri")}/silent-renew.html",
},
AllowedCorsOrigins = { $"{configuration.GetValue<string>("Clients:SPAClientUri")}" },
}
And on my Angular app, I'm using oidc-client for silent renewal:
my silent-renew.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<h1 id="waiting">Waiting...</h1>
<div id="error"></div>
<script src="oidc-client.min.js"></script>
<script src="silent-renew.js"></script>
</body>
</html>
silent-renew.js:
var Oidc = window.Oidc,
UserManager = Oidc.UserManager;
if ((Oidc && Oidc.Log && Oidc.Log.logger)) {
Oidc.Log.logger = console;
}
new UserManager().signinSilentCallback()
.catch((err) => {
console.log(err);
});
Thanks for your help, Kevin
Change the cookie settings used in your IdentityServer host UI.
https://identityserver4.readthedocs.io/en/latest/topics/signin.html#cookie-authentication
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Questions are community supported only and the authors/maintainers may or may not have time to reply. If you or your company would like commercial support, please see here for more information.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.