I use identity token-based and angularjs in my project, The token works properly in the local environment but expires in the server after 15 minutes. I set AccessTokenExpireTimeSpan = TimeSpan.FromDay(14) in middleware and check expire_in value in token, expire_in:1209599 equal to 14 day.
Apparently everything is right
OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions() {
AllowInsecureHttp = true,
TokenEndpointPath = new PathString("/token"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
Provider = new ApplicationOAuthProvider(PublicClientId),
};
app.UseOAuthAuthorizationServer(OAuthServerOptions);
app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
My server is Plesk
My Questions :
1- Should I set this setting(Expire Timeout) elsewhere?
OAuth2 WebApi Token Expiration
2- Do you really have to use RefreshToken?
http://bitoftech.net/2014/07/16/enable-oauth-refresh-tokens-angularjs-app-using-asp-net-web-api-2-owin/
3- Should I Config Plesk ???
4- Is related to the virtual server and machine key ???
asp.net identity expire bearer token after 20 min
Thank you for more details
2
Answers
i resolve this after a while. you must generate a appropriate machine key and add to your project's web.config.
you can generate machine key in : http://www.allkeysgenerator.com/Random/ASP-Net-MachineKey-Generator.aspx
As Amin said, it is correct
you must generate a appropriate machine key and add to your project’s web.config.
you can generate machine key in : http://www.allkeysgenerator.com/Random/ASP-Net-MachineKey-Generator.aspx
so, i have generated key as following :
and added inside
<system.web>
tag.Thanks !