Access Not Configured. The API is not enabled for your project - google-apps-script

I am trying to enumerate group members from Google Apps Script using the following code:
AdminDirectory.Groups.get("scouts#troop1313.com")
and getting this message
Access Not Configured. The API (Admin Directory API) is not enabled for your project. Please use the Google Developers Console to update your configuration. (line 65, file "Code")
I already authorized the script/project by running it directly from the online IDE but that did not help.
The project key is Mcdd3jWb8x_CBgWbrqpOo7WzCrlavxzZ2 and the function I am calling is getFolderContents.

Just a head up, Admin Directory API renamed to Admin SDK on API Manager.
Find that API and enable it helps solve the problem.

For advanced Google API's like the Admin Directory service you need to enable the service within your Google account's "developer console".
This authorisation is required in addition to the stock Apps Script authorization dialogues you mention in your question.
See the instructions here:
https://developers.google.com/apps-script/guides/services/advanced#enabling_advanced_services

Related

How to give users access to app script managed by a GCP Project

I have an app script linked to a spreadsheet that has a few functions to automate some processes for users. I recently updated the project to be linked to a standard GCP project I created so I could create OAuth credentials for an unrelated process in this script. However, now when users go to run the functions, they get a 403. Is there a place in the GCP console where I can give them access? I am not using any OAuth credentials for these functions. Just the standard app script interactions with the Google Sheet.
I think when you move to GCP you are required to use OAuth and they have to enter their credentials again. Found in the docs.
You have to configure the OAuth Consent Screen as is explained in the official docs about link a Google Apps Script project to a standard Google Cloud Project --> https://developers.google.com/apps-script/guides/cloud-platform-projects

Unable to get scope permission from G suite marketplace app

I have created a marketplace app to capture google drive changes.
Enabled two API & services.
1) Google Drive API
2) G Suite Marketplace SDK
Added required content in marketplace SDK and it is published via google chrome tool. So, got a marketplace app url which I can share with others and can install app in their domain.
With this app url I have installed an app by clicking on "DOMAIN INSTALL" button.
In order to receive notification of each drive changes my script is trying to create a channel for each user under this domain But, channel is not getting created. It shows error called "invalid_grant"
So, I took another approach to add marketplace client id and scope permissions under Admin Console->security->Advance Setting ->Manage API client access manually.
Now, I am able to create a channel for user in domain and can access drive files content.
Please help me to figure out that why I am not able to get permission while installing a published G suite marketplace app?
Thanks you.

Where to enable Drive service in the admin console?

In my Apps Script project, I'm trying to loop through folders in My Unit using DriveApp.getFolders(). When the code reaches while(folders.hasNext()), I get the following error:
"The feature you are attempting to use has been disabled by your domain administrator."
However, Google Drive service is enabled for all users on the domain.
Is there another security setting I need to ask the domain admin to enable?
You need to enable "Drive Apps" as well.

google drive api access not configured

I am following the google drive android quick start sdk here. The only difference is that I am using intellij instead of eclipse.
The app throws an exception when uploading the file:
File file = service.files().insert(body, mediaContent).execute();
The exception message is access not configured.
Now googling this error yields some results:
google drive api error 403 Access Not configured
Google Drive HTTP 403 "Access Not Configured" error with DrEdit
I have checked in the google cloud console that both the drive api & the drive sdk are activated. I have registered an app with the correct package name. I also added google cloud storage just in case. What else should I check?
Edit
I am really confused by the documentation. This page mentions the getToken method, but the sample application uses GoogleAccountCredential.usingOAuth2 which documentation is Constructor a new instance using OAuth 2.0 scopes.
When registering the application, I get some information like client secret/client ID. I could find information here explaining how to use this data, but I could not find this kind of example for an android app.
In the API Console, when you register/create an app, a Client ID is generated. Have you coded that Client ID into your app? The answer to the first SO link you gave has details.

Google Drive HTTP 403 "Access Not Configured" error with DrEdit

I'm attempting to install the DrEdit sample app for python onto GAE. The app runs, but saving or opening a file results in an HTTP 403 "Access Not Configured Error".
client.json has client_id and client_secret set per the API Access>Client ID for Drive SDK values. I have also attempted to use the values for API Access>Client ID for web applications.
The Google Drive SDK> OAuth Client ID has also been set variously to the Drive SDK and web app Client IDs.
What am I doing wrong?
In the services section of the Google API console there are two services relating to drive development, SDK and API. When you create a new Drive SDK entry, Drive API service is not automatically enabled (which doesn't make sense, I don't see when you'd create a drive enabled application without using the drive API). Switch the Drive API service on for the project and try again.
#lurking_googlers I think a lot of people will fall for this, doesn't it make sense to enable the API when the SDK is enabled?
And your must also identify in your code the following
DriveService.Scope.DriveFile, DriveService.Scope.Drive
good luck