Every time you use a Google apps script class in your script that accesses your account or data, Google will inform you and ask for your consent. Also, every time you add a new class that accesses your data you will have to go through the process again.
This process is not straight forward like click here to accept permissions, you will have to deal with a couple of dialogs, and it can get confusing. So, check this guide if you have any problem accepting the permissions and running your script.
Run the script or add a trigger
First, you need to run the script, so you can use the run button from the toolbar or you can add a trigger. In both situations, Google will ask you to accept permissions.
Next, Google script will inform you that you need to review and accept certain permissions for the project “Export and email as PDF 1”
After you press on the “Review Permissions” button, a new window will open to let you select which account to use to grant permission to your script. If you are logged in with more then one account, you have to select which one to use. Just click on the account to continue.
Here is the part that can get confusing if you don’t notice the link in the bottom left. Also, If you are using a G Suit account you won’t get this type of notification and you can skip ahead.
So, Google will inform you that this app isn’t verified and to only proceed if you know and trust the developer. Since you are the developer, and I hope you trust yourself (and me), click on the link “Advance” to open the extra options.
Here, again, Google will note that the app hasn’t been reviewed and it will give you the link to continue “Go to Export and email as PDF 1 (unsafe)” (for you it’s going to be the name of your script).
After you click on the link, a new window will open with the list of permissions that the app needs. Review the permissions and click on the “Allow” button.
That’s it, now your script can execute and hopefully give you the result you expect.