public async Task <ActionResult <LoginResponse> > RefreshAsync([FromBody] RefreshTokenRequest request) { var dbToken = await jwtManager.FindRefreshTokenAsync(request.RefreshToken); if (dbToken == null) { return(NotFound("Refresh token couldn't be found.")); } if (!jwtManager.CheckTokenExpireTime(dbToken.Token)) { await jwtManager.DeleteRefreshTokenAsync(dbToken); return(BadRequest("Refresh token is invalid and was deleted from database.")); } var user = await jwtManager.GetUserFromTokenAsync(dbToken.Token); await jwtManager.DeleteRefreshTokenAsync(dbToken); return(Ok( await GetLoginResponseAsync(user) )); }