r/GoogleAppsScript • • Mar 25 '23

Question How to unblock Apps Scripts?

When I try to run Apps Scripts for any script that works on other Google accounts I get this error

This app is blocked

This app tried to access sensitive info in your Google Account. To keep your account safe, Google blocked this access.

There is no option to allow access or to edit this from the pop up window. In my account security/3rd party panel the app doesn't show.

I can't run any scripts in this account.

Is there a way to 'unblock' or add App Scripts in my account manually?

Thanks,

6 Upvotes

11 comments sorted by

View all comments

Show parent comments

1

u/IAmMoonie Mar 26 '23

Have you definitely authorised it?

Try copy and pasting this and running the function from the editor:

function auth(){
   console.log(“authorised”)
}

It will force authentication for the account that you’re using if it’s not already authorised the APIs.

What is your script doing?

1

u/DReid25 Mar 27 '23

Thanks. When I tried to save the script on its own I received this error. I was unable to save and run.

Syntax error: SyntaxError: Invalid or unexpected token line: 2 file: Code.gs

1

u/MuzdogMillionaire Mar 29 '23

Doesn't look like an auth error, seems like whatever you have on line two of the script isn't valid.

The scripts wont save if you have invalid code. Try comment it out by putting // at the start of line 2 and then try and save. If it saves, or moves on to the next error you'll have to fix your code.

1

u/DReid25 May 05 '23

Sorry for the long delay in responding - got COVID!
Ok the script works in other accounts. I've tested with the most basic script and transferred ownership of the files to other accounts and everything worked with authenticating it.

When I check my security settings this app doesn't show up anywhere.

Is there a way to manually add this app to my security settings?

The error again is

"This app is blocked
This app tried to access sensitive info in your Google Account. To keep your account safe, Google blocked this access."

Thanks

1

u/unicyclebrah Aug 29 '24

I've had this same issue on one of my google accounts for over a year now. My workaround was to create a google cloud project and link the apps script to that project id. Problem is you have to then re-allow the script to access your account every week or so otherwise it will fail to run. Have you had any success circumventing this error message? It's frustrating to just see 'this app is blocked' on the auth screen instead of having the ability to 'trust' the app.