What year is it? Could be an immobiliser problem. It will let u start the car but then it cuts out <5secs.
Faulty ignition switch usually doest let u start i.e. u turn the key and nothing happens so i doubt its that but its cheap to replace so u can change it and see if anything happens.
Get it scanned for codes would be the first port of call methinks.