public async Task <AuthResult> RefreshTokenAsync(RefreshData refreshData) { var claimsFromToken = _jwtManager.GetPrincipalFromToken(refreshData.Token); if (claimsFromToken == null) { return(AuthResult.CreateWithSingleError("Invalid token format.")); } var storedRefreshToken = await _jwtManager.GetRefreshToken(refreshData.Token); if (!_jwtManager.ValidateRefreshToken(storedRefreshToken, claimsFromToken)) { return(AuthResult.CreateWithSingleError("Invalid token")); } await _jwtManager.UseRefreshToken(storedRefreshToken); var user = await _userManager.FindByIdAsync(_jwtManager.GetUserId(claimsFromToken)); return(await GeneraAuthResultAsync(user)); }