Ejemplo n.º 1
0
 public async Task <TokenResponseResult> RefreshToken([FromBody] LoginRequest request)
 {
     try
     {
         DateTimeOffset offset = new DateTimeOffset(DateTime.Now);
         offset = offset.AddDays(7); //7天内过期
         string userId = request.Key;
         string token  = request.Value;
         return(new TokenResponseResult()
         {
             Code = 200,
             AccessToken = _signInManager.RefreshToken(token, Issuer, Audience, _signingCredentials,
                                                       userId, HttpContext.User.Claims, offset)
         });
     }
     catch (Exception ex)
     {
         _logger.LogError(ex, "SignInController.refreshtoken");
         return(new TokenResponseResult()
         {
             Code = (int)System.Net.HttpStatusCode.ExpectationFailed,
             Message = ex.Message,
         });
     }
 }