What is being echo’ed/outputted when you run this?
Plugging my own ClientID/ClientSecret into the script
It ran successfully.