The script had issues unrelated to the API key. Please update to the latest version and check if it’s fixed on your end.
I didn’t look into possible API key retrieval problems, since you demonstrated that you’re capable of inputting it manually in the script. Be sure to input your key from API version 1 though!