If you're getting errors for Google App Script API:
The answer below should remedy the issue.
If you find this helpful, please remember to contribute to hard-to-find issues especially for Google API services since they're often poorly documented and solutions are not complete (I usually find workarounds that are not secure).
Edit: I feel the possible duplicate link goes more in depth on one issue. This post has 2 key phrases and it solves them quickly. If the visitor feel they need to go more in depth, then the possible duplicate link would be a good choice: How to run Google App Script function from Google OAuth 2.0 Playground | The caller does not have permission
I've also searched thoroughly using the key phrases of the issues but I couldn't find any that solves it satisfactorily. The answer also tells the user that they don't need to share their document publicly and no service account is needed which I feel is important. The conciseness of the answer I feel is helpful. Though I will close this post if there's a helpful explanation on why it should be closed.
First go into your script:
Note: I find many solutions that share the document to public and also a service account requirement, this is not required.