google drive api access not configured - google-drive-api

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.

Related

What to put as 'Authorized Domain' under Firebase authentication for a single page Google App Script webapp

In my Google App Script webapp, I would like to implement Firebase Phone authentication using FirebaseUI. But I am getting an error 'Hostname match not found' error when authenticating after reCaptcha verification.
So, please help me to understand:
If Firebase phone auth can be implemented for GAS webapps using FirebaseUI?
If yes, then what should I put as the 'Authorized Domain'? (I have tried with script.google.com, but it did not work)
Edit: After further studying, I found that the GAS webapp is served over a subdomain of script.googleusercontent.com and was able to use FirebaseUI phone auth by adding the subdomain as 'Authorized Domain' under Firebase auth.
Now, I would like to understand:
The subdomain over which a GAS webapp is served, is it exclusive and static per appscript project?

Access Not Configured. The API is not enabled for your project

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

Error 403 while retrieving all the files in the Google Drive using domain-wide delegation

I am Getting Error 403 (You are not authorized to perform this request. That's all we know.) while retrieving all the files in the Google Drive using domain wide delegation. It is interesting as i am not getting the error for the first 12 times that i am acquiring the files but, after that i keep getting it.
If you'r getting Error 403 than there can be various reason like -
403: The authenticated user has not installed the app with client id {clientId}
403: The authenticated user has not granted the app {appId} access to the file {fileId}
403: Invalid accessLevel. This method requires at least {requiredAcl} level access to act on the file with ID {fileId}
403: The app with id {appId} does not exist or is not properly configured as a Google Drive app
403: App with id {appId} cannot be used within the authenticated user's domain
403: The app with id {appId} is blacklisted as a Google Drive app
According to Google Drive Developer. Please Check HERE for More Details. I hope you will be able to find out the cause of 403 Error.

403 Forbidden error when accessing Google Drive API downloadURL

I've been doing a lot of development locally with the Google Drive API, but suddenly I'm no longer able to access files using the downloadUrl link.
I'm wondering if I've been blocked or anything, although I can't see how as I should be well under the API limit. The 403 isn't the friendly Google one, but a standard:
HTTP Error 403 (Forbidden): The server refused to fulfill the request
Any ideas? Thanks!
Check the error messages on the 403 responses, it will give you some information. You may have to perform exponential backoff.
you are accessing google drive file using download url bt download url is expired after some time so that you catch error and generate new request for that file

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