This scripture needs to be looked at in context of the two preceding scriptures. After Jesus was resurrected, he appears to his apostles and tells them, ‘As the Father has sent me, I am sending you.’ And with that he breathed on them and said, ‘Receive the Holy Spirit. If you forgive anyone his sins, they are forgiven; if you do not forgive them, they are not forgiven.’” (John 20:21-23) Jesus is speaking directly to his apostles who, after Pentecost, would possess a great measure of the Holy Spirit and have the ability to perform miracles. During the course of their ministry, they would define sin and the terms and conditions on which it would be possible to have sins forgiven (heart-felt repentance, justification and reconciliation). Even though Jesus had the power to forgive sins when he walked the earth because he had authority from his Father to do so (Mark 2:10), he did not give that power to the apostles. However, the apostles did have the gift of discernment so that they were able to recognize when a person was lying as well as when one was truthful and repentant. For example, the Apostle Peter was able to discern that Ananias and Sapphira were lying when they said that they had given all the money from the sale of their property to the church (Acts 5:1-11). Because Peter possessed the Holy Spirit he was able to read the hearts of these individuals and knew that they were not contrite and worthy of forgiveness.
The fact that a person refuses to forgive you for a past offense against him has no bearing on the John 20:23 scripture or on whether God forgives you or not. No human has the authority to absolve another human of past sins. Human forgiveness of sin is entirely different from God’s forgiveness. We humans are commanded to forgive each other, whether or not the person who offended us is worthy of forgiveness or not. (See Matthew 6:14, Luke 6:38, Mark 11:25.) However, only God has the ultimate authority to absolve the offender of sin.