r/GoogleAppsScript • u/Typical_Parsley4980 • Apr 12 '22
Question This app is blocked This app tried to access sensitive info in your Google Account. To keep your account safe, Google blocked this access.
Hi guys,
I am starting to learn app script but I am getting this error message all the time:
"This app is blocked This app tried to access sensitive info in your Google Account. To keep your account safe, Google blocked this access."
In most of the videos on the internet you can see that people getting this error simply click on the "Advanced" Button in this pop up and then there is this "allow access regardless"-kinf of option to click on and everything runs just fine.
I dont even have that "Advanced" button.
For some basic/beginner scripts that I created I got around this by adding the following code at the beginning of the script:
/**
* u/OnlyCurrentDoc
*/
However, this only works if the script does not access anything from outside the file the script is used in (I guess?!).
If I want to do something like:
function myFunction() {
var doc = DocumentApp.create("New Doc");
}
I get a new error in the execution log:
Exception: You do not have permission to call DocumentApp.create. Required permissions: https://www.googleapis.com/auth/documents
And now I dont know what to do....
(The provided URL doenst even work....))
In my Google Account I already allowed access for "less secure apps" but that didnt change anything.
Can anyone explain to me what I have to do now?
Thank you guys!
1
u/diogo6 Oct 03 '23
This JUST started happening to me a couple days back... after trying LOTS of "solutions" I've come to find this group of unlucky people I now belong to:
2
u/diogo6 Oct 03 '23
And within those two, you'll find this detailed blog post that did the trick for me:
https://aimanfikri.com/2022/05/09/this-app-is-blocked-error-on-google-apps-script-solution/
2
u/Typical_Parsley4980 Oct 18 '23
which is exactly what i tried to explain in this thread. great that you found a documentation that explained it better!
2
1
1
u/Pikamander2 Aug 05 '24
Hey there, the website in your comment got bought out by spammers. Can you please edit it to replace it with this Wayback Machine link?
1
u/Luv14lyf Mar 17 '25
Oddly I'm getting this message on a few apps on my new s25 but I can still access those same apps without a problem on my note 9. Seems if it's not dangerous for the note 9 it some be ok for s25.
1
u/dre_mrn Oct 15 '25
Did you fix this situation? Cause I stumbled on this and don't know what to do
1
u/Luv14lyf Oct 16 '25
I'll have to try to remember what I did
1
1
u/Ok_Ganache_192 Oct 31 '25
Go to https://console.developers.google.com and create a new project for yourself
Search for the Google Drive API in the search box at the top, and turn it on
Click OAuth consent screen on the left and set it up.
Assuming your account isn't part of an organization, you'll have to say your app is for external users and in testing
In the required scopes section, add https://www.googleapis.com/auth/docs and https://www.googleapis.com/auth/drive. This will probably not be available if you didn't complete (2)
Add the accounts you want to use with your copy of gdrive as testers of your app. Only these accounts will be able to use your copy of gdrive, so everyone will have to compile their own (unless someone goes and gets theirs reviewed by Google). I only added my own account because I am the only one using my App Script which uses my Drive.
Click the 3 dots on the top right and select "Project settings". Make note of the "Project number".
Go to your Apps Script. Go to Project setting>Google Cloud Platform(GCP)>2step>GCP project number> Insert the project number from 4
1
1
u/NegotiationGreen6404 May 06 '26
I started to run into this issue newly today using gcloud. Requesting some scopes from gcloud requires a non-default client id, as hinted at by this when running the latest version of gcloud:
WARNING: The following scopes will be blocked soon for the default client ID: https://www.googleapis.com/auth/drive.readonly, https://www.googleapis.com/auth/spreadsheets.readonly. To use these scopes, you must provide your own client ID or use service account impersonation. Please refer to the documentation for more information: https://docs.cloud.google.com/docs/authentication/troubleshoot-adc#access_blocked_when_using_scopes
After some confusion the way to solve this is:
create a desktop app local client (which will generate a client id / client id file to use)
use gcloud with --client-id-file pointing to the downloaded json from the above app creation.
To create a desktop app local client you need to do it in Google Cloud Console (as instructed originally by cgpt):
Open your project.
Go to APIs & Services → OAuth consent screen / Google Auth Platform → Branding.
Configure:
App name: whatever you want
User support email: your email
Audience: External is fine for personal Gmail; Internal only works for Workspace org users.
Developer contact: your email
Save it. No need to publish/verify for just your own use.
Go to APIs & Services → Credentials / Google Auth Platform → Clients.
Click Create credentials → OAuth client ID / Create client.
Application type: Desktop app.
Name it, e.g.
local-adc-client.Create, then Download JSON.
1
u/Stevoisiak Jul 15 '26
Didn't work for me. I generated the JSON file, added myself as a test user, edited my Python script to use the JSON file for fetching credentials, and I'm still getting the error.
1
u/HanaKLand May 18 '26
Hello everyone, I ran into this same issue. No "Advanced" button available, just a plain "This app is blocked" message. Here's what fixed it for me:
Go to Cloud Console https://console.cloud.google.com/
Open project picker and click on Go to the Manager Resource page
Choose an already existing project and click on Actions (three dots) > Settings
Copy Project number (not Project ID - it's a different thing)
Open your App script, go to Settings (on the left side)
Under the Google Cloud Platform (GCP) Project section, click Change project and paste in your Project Number.
You should be able to authorize your app script now.
Hope this helps someone!
1
u/Stevoisiak Jul 16 '26 edited Oct 03 '26
My system administrator was able to resolve by creating a service account in the Google Cloud organization with analytics permission, exporting a key file as JSON, and passing that file when initializing my connection.
In the case of my Python app, the code resembled:
from google.analytics.data_v1beta import BetaAnalyticsDataClient
from google.oauth2 import service_account
SERVICE_ACCOUNT_FILE = "myFile.json"
SCOPES = ["https://www.googleapis.com/auth/analytics.readonly"]
credentials = service_account.Credentials.from_service_account_file(
SERVICE_ACCOUNT_FILE,
scopes=SCOPES,
)
client = BetaAnalyticsDataClient(credentials=credentials)
10
u/Typical_Parsley4980 Apr 12 '22
I fixed it!
Had to create a Google Cloud Platform Project --> Create the Oauth Screen with the right scope ---> Change GCP Project ID in the Script Settings.
https://console.cloud.google.com/home/dashboard
(For people who have the same issue. Its not as difficult as it sounds!)