Could not get Authorize via OAuth authentication in Google Drive API - google-drive-api

When I create a folder in Google Drive using Google Drive APIs.I am using Oauth, But while using Oauth it gives me error of access block.
Please find the below error
https://i.stack.imgur.com/lWDc7.png

Related

How to save a file from URL to Google Drive

is there a way to automatically download a file "example.com/example.zip" directly to my Google Drive instead of downloading it to my server and uploading it again?
In Drive API there is no method to upload a file directly from a URL, with files.create you still have to upload the media. But if you don't want to use your server, you can go for Apps Script, which gives you access to the Drive API via the Advanced Drive Services, as well as the Built-in Drive service, plus some other services like Url Fetch Service with which you could make a request to download from the URL of the file and capture the blob; then use DriveApp.createFile(blob) to upload to Drive.
The beauty of it, it all happens in the cloud in Apps Script servers. Of course you are subject to Apps Script's and Drive API's quotas and limits.
Quotas for Google Services

Is it true that the Drive API does not revoke the token but the Gmail API revokes when the account password is changed?

UPDATE TITLE: "Why does RCLONE work with Drive API without credentials, while Gmail API doesn't?" to "Is it true that the Drive API does not revoke the token but the Gmail API revokes when the account password is changed?"
What does the link below say are only valid for the Gmail API? Because with the rclone application, even if the password was changed, the token was never revoked.
https://support.google.com/a/answer/6328616?hl=en
I don't know how RCLONE works, but at a certain point it has to make the OAuth process to authenticate your app and let it use the Drive API.
OAuth 2.0 The authorization protocol that Google Drive API requires to
authenticate your app users. If your application uses Google Sign-in,
it handles the OAuth 2.0 flow and application access tokens.
Now, this PHP Quickstart will give you guidance on how to use the Gmail API, there it shows how to download and use the credentials.json file.
Docs
For more additional info, read this:
Authenticate your users
Enable the Google Drive API

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

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