Currently, web api configured for token authentication with 30 min timeout as below:
public void ConfigureOAuth(IAppBuilder app)
{
OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions()
{
AllowInsecureHttp = true,
TokenEndpointPath = new PathString("/token"),
AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(30),
Provider = new SimpleAuthorizationServerProvider()
};
// Token Generation
app.UseOAuthAuthorizationServer(OAuthServerOptions);
app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
}
Problem: even though user is working onsite, token gets expires and user just get unauthorize and need re-login (to get new token).
Looks, need to extend expiration time on each request to next 30 min.
I don't know how I could achieve this. Or what is the best solution to this.