Gay sex is not illegal in the rest of Indonesia, which mainly follows a criminal code inherited from former colonial ruler the Netherlands.
Authorities in the province on the northern tip of Sumatra island caned 339 people in 2016 for a range of crimes, according to HRW.
People caught gambling and drinking alcohol have for some years been punished with public canings.
Under a local law that came into force in 2015, people can also be punished for having gay sex with up to 100 strokes of the cane.
Police later arrested the distressed couple, who said they were in a relationship and had had sex three times.
Access to their snapchat, kik, skype and more are just a tap away.
Practice your sexting skills on our secure chat servers, or share sexy pictures to horny people right in your area!
The hearing was closed to the public and the men's identities were not revealed due to the sensitivity of the case.
The father of one of the defendants, who requested anonymity, said he did not know his son was gay before he was caught.'This is an ordeal for our family,' he said.