It was illegal because it violated the UN Charter.
The UN Charter doesn't matter at all and no power pays any attention to it. Russia invading Georgia, for one of many, many instances. The 1967 Israeli/Arab war, for another.
There is no law without enforcement, and international law cannot have any enforcement, because there is no enforcing power above all the sovereign nationstates, so that's that.
As for whether it was illegal under OUR law, which is all that matters, probably not since Congress approved it, though Congress did not vote a Declaration. So I'm not sure. I'd a lot rather see Declaration, but it never happens anymore, and yet we still have wars, so what does "legal" MEAN in that context?
Not much, probably.