我在WebAPI应用程序中使用基于令牌的身份验证。我将令牌的过期时间设置为7天,但似乎只能使用几分钟,几分钟后它会自动过期。
OAuthAuthorizationServerOptions options = new OAuthAuthorizationServerOptions
{
AllowInsecureHttp = true,
TokenEndpointPath = new PathString("/logintoken"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(7),
Provider = new MyAuthorizationServerProvider(),
};
响应...
{
"access_token": "uQWtAZmLx33_CvnkjOsdfsdfK1tJOGAt50vzNqW8mRbaZqlsaNvI2aQSpc2Ii9Nj4nrce0LaDm6R2WKBwert54WiUpyXwEUMGrKcBLWAZ765KN4qfGQm9DZulS6wCeIbScO7RahlMFJ2SCNVAxGDUUbx7hDdvuFwlTtcDSowbv04jLf42_QH0_DTajqIIJT_PvRwyqobCqWvclntqdHwxsRWDbhDEH6Z1WJBoRFPflczw-gwFlzZdYYoFxttKJg6i95CM0auNnRc_L4c33t6saWcIs1JZY6jxgr6X8CXLKX5E2l3tG4e5lvBWqX4D17KgqWhGt5EGjD1bF7lYYAbsaNLglPqezgnG9uA",
"token_type": "bearer",
"expires_in": 604799
}