In 2011, Obama invaded Pakistan to kill Osama Bin Laden.
In 2011 Obama was operating under the 2001 Authorization for Use of Military Force (2001 AUMF).
The 2001 AUMF authorized military action against entities that "planned, authorized, committed, or aided the terrorist attacks that occurred on September 11, 2001, or harbored such organizations or persons," a description that could encompass groups like al-Qaeda who were active in Pakistan.
Does Trumpy have a AUMF or any type of authorization from Congress for the use military force against Iran?
Also, it's not true that "nobody complained". Someone always complains. But most of the world supported Obama at the time. Even the UN Secretary-General at the time expressed his relief that "justice has been done to such a mastermind of international terrorism".
So sayeth my AI guy.