Override AccessTokenExpireTimeSpan

后端 未结 3 755
后悔当初
后悔当初 2020-12-17 20:33

Is possible to override the default AccessTokenExpireTimeSpan for a specific ticket on a custom OAuthAuthorizationServerProvider? The default expiration time for all other t

3条回答
  •  攒了一身酷
    2020-12-17 21:24

    This works in the context (ha ha) you have:

    public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
    {
         context.Options.AccessTokenExpireTimeSpan = YourCustomExpiryTimeHere();
    } 
    

    But note, will need to be updated on every call or the last value you assign will be kept for the next login that occurs.

提交回复
热议问题