public async Task <ApplicationActionResult <AuthResult> > Refresh(JwtTokenModel authToken) { AuthResult refreshResult = new AuthResult(); string userLogin = _tokenHelper.GetUserNameFromExpiredToken(authToken.AccessToken); ApplicationUser user = await _userManager.FindByNameAsync(userLogin); //Validate refresh token if (user.RefreshToken != authToken.RefreshToken) { refreshResult.InvalidRefreshToken(); return(new ApplicationActionResult <AuthResult>(refreshResult, (int)Core.Constants.ActionStatuses.Fail, "")); } //create access and refresh token var token = await _tokenHelper.CreateJwtTokens(user); //save user refresh token in database user.SetRefreshToken(token.RefreshToken); await _userManager.UpdateAsync(user); refreshResult.SuccessAuth(token); return(new ApplicationActionResult <AuthResult>(refreshResult, (int)Core.Constants.ActionStatuses.Success, "")); }