1

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.

Roman Marusyk
  • 23,328
  • 24
  • 73
  • 116
dsi
  • 3,199
  • 12
  • 59
  • 102
  • How ideal way that match with token implementation to solve this. I am new to this authentication. – dsi Jan 19 '17 at 13:02
  • 1
    See http://stackoverflow.com/questions/20637674/owin-security-how-to-implement-oauth2-refresh-tokens – Roman Marusyk Jan 19 '17 at 13:14
  • 1
    you should have a look at refresh tokens, e.g here: http://bitoftech.net/2014/07/16/enable-oauth-refresh-tokens-angularjs-app-using-asp-net-web-api-2-owin/ – jps Jan 19 '17 at 13:17
  • Thanks. same thing looking for. I'll implement service for refresh token. It will resolve. – dsi Jan 19 '17 at 13:24

0 Answers0