403 Forbidden error when accessing Google Drive API downloadURL - google-drive-api

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

Related

Why do I get a 403 error when I tried to open a website?

I tried to go to [capterra.com], but I get this error:
403 ERROR
The request could not be satisfied.
Request blocked. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
Generated by cloudfront (CloudFront)
Request ID: gl_jhiv6CXIVdD-qAeFEQXy9ymYLGqqXOR5MOKQI3Jpu2dlQk4tWIw==
What should I do?

Downloading from Google Drive returns 403 Forbidden after a while

I am downloading files with a ASP Web Application from Google Drive, using a service account, OpenAuth2 and a .p12 key file.
This works great, but after a while (10-12x downloading), it fails with a ProtocolException.
The inner exception is: "The remote server returned 403 Forbidden".
After about 3 minutes, the downloads succeed again(!).
Can anyone explain what is happening, and more importantly, how to fix this problem?

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.

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