Federal government authority over Keystone XL and Dakota Access pipelines

I’ve read some material on these and I guess my question is too simple and obvious to write about.

These pipelines seem to be commercial projects. What authority does the federal government have to block (Obama) or permit (Trump) these projects?

Regarding the Keystone XL pipeline, any border crossing requires a Presidential Permit issued by the Secretary of State. See https://www.state.gov/p/wha/rt/permit/

The Dakota Access pipeline crosses some federal land that requires a federal permit.

Seems that the Interstate Commerce Clause may apply, as well.