を契機に・をいいことに: the difference
を契機にN2
Meaning
Lead to, As a good opportunity to, As a result of, As a trigger
Past papers
Example
子供の独立を契機に家を改造することにした。
As a result of my children becoming independent, I decided to remodel the house.
をいいことにN1
Meaning
To take advantage of
Past papers
Tested once in past papers
Example
彼は私が稼いでいるのを良い事に、遊んでばかりいます。
Taking advantage of the fact that I'm earning money, he does nothing but play around.
How to tell them apart
「をきっかけに/を契機に」 is neutral or positive 'triggered by': 「病気を契機に健康を意識する」.
「を口実に」 means 'using it as an excuse', not necessarily bad behavior.
「をいいことに」 is more than an excuse: it means exploiting the chance to do as you please, and the criticism is strong.