How to set identity token and access token timeout, my application do not redirect to logout when access token exipres
I have Asp.Net Core application and use AngularJS secured with identity server, I made request to Web API, Web API is secured with Identity server, every thing works fine until some one left website open for some time , may be 20 minutes to so on then issue pop ups, issue is that web application make request to web api, response is some time 401 and some time -1.I use angular http interceptor for that but its not work perfect,
What i need is to setup identity token, and access token timeout like 2 hours after that system should redirect to logout page.
This seems to be a general question about IdentityServer - not a bug report or an issue.
Please use StackOverflow for that. This has the advantage that questions and answers can be easily found by search engines, and that there are more people answering questions than just us.
For IdentityServer3 https://stackoverflow.com/questions/tagged/?tagnames=identityserver3&sort=newest
For IdentityServer4 https://stackoverflow.com/questions/tagged/?tagnames=identityserver4&sort=newest
For commercial support options - visit https://identityserver.io
Agreed, I searched a lot, found some help but it not works in latest version of identity server, now I just want to know how to set Identity Token and Access Token time out in latest version of identity server, if you can help me , I will be very thankful.
Both are settings on the client object.
Thanks I got it, They are setup in identity server project, I was trying to set on client project.
Dude, do you still here? How did you solve that?
new Client
{
ClientId = "WebAppId",
ClientName = "Web Application",
RequireConsent = false,
AllowedGrantTypes = GrantTypes.HybridAndClientCredentials,
ClientSecrets = new List
Thanks
Welcome
On Tue, Aug 15, 2017 at 4:34 AM, webcrack4 [email protected] wrote:
Thanks
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/IdentityServer/IdentityServer4/issues/857#issuecomment-322338167, or mute the thread https://github.com/notifications/unsubscribe-auth/AFOwsQ9ir0IjYdlApmq46MxulpvZOc09ks5sYNmigaJpZM4MPW68 .
-- Regards Khurram Shahzad
can i change AccessTokenLifetime at runtime? If yes, how?
new Client
{
ClientId = "Abc",
ClientName = DEF",
RequireConsent = false,
AllowedGrantTypes =
GrantTypes.HybridAndClientCredentials,
ClientSecrets = new List
On Wed, Nov 8, 2017 at 2:27 AM, gummadikalyan [email protected] wrote:
can i change AccessTokenLifetime at runtime? If yes, how?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/IdentityServer/IdentityServer4/issues/857#issuecomment-342627947, or mute the thread https://github.com/notifications/unsubscribe-auth/AFOwsete8Rz3QPLSJif4tDRJ4NZqlZRZks5s0MtdgaJpZM4MPW68 .
-- Regards Khurram Shahzad
Solved using Identity Server Entity Framework.
appBuilder.Map("/core", coreApp => { var context = new DatabaseContext(); var efConfig = new EntityFrameworkServiceOptions { ConnectionString = context.ConnectionString, };
// these two calls just pre-populate the test DB from the in-memory config
ConfigureClients(Clients.Get(), efConfig);
ConfigureScopes(Scopes.Get(), efConfig);
var factory = new IdentityServerServiceFactory();
factory.CorsPolicyService = new Registration<ICorsPolicyService>(new
DefaultCorsPolicyService { AllowAll = true });
factory.RegisterConfigurationServices(efConfig);
factory.RegisterOperationalServices(efConfig);
// note: this registration is a singleton
factory.UserService = new Registration<IUserService, CustomUserService>();
var options = new IdentityServerOptions
{
SiteName = "Fabric Identity Server",
SigningCertificate = LoadCertificate(),
Factory = factory,
EventsOptions = new EventsOptions
{
RaiseSuccessEvents = true,
RaiseFailureEvents = true,
RaiseErrorEvents = true,
RaiseInformationEvents = true
},
RequireSsl = false
};
appBuilder.UseIdentityServer(options);
});
Update the "AccessTokenLifetime " database value using web api Route.
I set AccessTokenLifeTime to 3600*24*10 = 10 days; but the token still expires after one day. Anyone knows why?
Use the refresh token to request a new one. RefreshTokenUsage = TokenUsage.OneTimeOnly, RefreshTokenExpiration = TokenExpiration.Sliding
Sorry I don't understand. Why does the token expire after one day if I set it AccessTokenLifeTime to 10 days? If AccessTokenLifeTime doesn't decide the lifetime of the access token then its name is very confusing.
AccessTokenLifetime should be in seconds.
I did set it to second e.g. 3600*24*10 seconds which is equal to 10 days.
Do a simple math and convert 10 day in to seconds and apply to AccessTokenLifetime please.
Are you saying if I set it to 20*30 then it will only set it to 20 seconds instead of 600 seconds?
Yes, You need to do the exact math before assigning AccessTokenLifetime in seconds.
I just tested. Setting TokenAccessLifeTime to 3600*24*10 does set the token expiration to 10 days so I am not sure why my supposedly unexpired access token doesn't work after 1 day...