Lỗi access to doc-0c-cc-docs.googleusercontent.com was denied

If you have ever gotten the error "Access to doc-08-1g-docs.googleusercontent.com was denied" while downloading from Google Drive or gotten the error "You are not authorized to view this page" in general in Chrome, you may have learnt the solution is to clear the browsing data or cookies to fix the problem.

That indeed does fix the problem but it does not really address why the error occurs in the first place.

This error occurs when you are signed into more than one google account and trying to download something or access something from a NON PRIMARY google account. If the download link generated opens in another tab, then your PRIMARY google account is actually trying to open the link, which is why you get the "Not autorized error". It is a legitimate error because your primary google account is indeed not authorized to open another accounts links.

This is the reason clearing browsing data or cookies fixes the problem as it logs you out of all the google accounts.

The easiest way to fix it is by opening a Incognito window and download it there or making the account you are downloading from the primary account.

I'm using the default code provided from google here, and I don't quite understand why its not working. The code outputs the prompt Please visit this URL to authorize this application: [google login URL]. When attempting to log in with the account designated as owner of the script under the google developers console I get a Error 403: access_denied error with the message The developer hasn’t given you access to this app. It’s currently being tested and it hasn’t been verified by Google. If you think you should have access, contact the developer [the email I just tried to log in with].

from __future__ import print_function
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly']
# The ID and range of a sample spreadsheet.
SAMPLE_SPREADSHEET_ID = '1vrZpCGW58qCCEfVXoJYlwlulraIlfWI2SmFXa1iPtuU'
SAMPLE_RANGE_NAME = 'Class Data!A2:E'
def main():
    """Shows basic usage of the Sheets API.
    Prints values from a sample spreadsheet.
    """
    creds = None
    # The file token.pickle stores the user's access and refresh tokens, and is
    # created automatically when the authorization flow completes for the first
    # time.
    if os.path.exists('token.pickle'):
        with open('token.pickle', 'rb') as token:
            creds = pickle.load(token)
    # If there are no (valid) credentials available, let the user log in.
    if not creds or not creds.valid:
        if creds and creds.expired and creds.refresh_token:
            creds.refresh(Request())
        else:
            flow = InstalledAppFlow.from_client_secrets_file(
                'Google_API_Key.json', SCOPES)
            creds = flow.run_local_server(port=0)
        # Save the credentials for the next run
        with open('token.pickle', 'wb') as token:
            pickle.dump(creds, token)
    service = build('sheets', 'v4', credentials=creds)
    # Call the Sheets API
    sheet = service.spreadsheets()
    result = sheet.values().get(spreadsheetId=SAMPLE_SPREADSHEET_ID,
                                range=SAMPLE_RANGE_NAME).execute()
    values = result.get('values', [])
    if not values:
        print('No data found.')
    else:
        print('Name, Major:')
        for row in values:
            # Print columns A and E, which correspond to indices 0 and 4.
            print('%s, %s' % (row[0], row[4]))
def PrintToSheets():
    main()

https://stackoverflow.com/questions/48678478/how-to-download-file-from-google-drive-with-link-in-android). Links are working fine in the mobile browser on Android and computer browser. The problem only occurs on WebView-based apps in Android.

But here is good news: WebViewGold for Android offers a simple solution for this! Please configure “drive.google.com” as a host to be opened externally, see https://www.webviewgold.com/docs/android/ – this should solve the problem 🙂

Google Drive Help

Sign in

Google Help

  • Help Center
  • Community
  • Google Drive
  • Privacy Policy
  • Terms of Service
  • Submit feedback

Send feedback on...

This help content & information

General Help Center experience

  • Help Center
  • Community

Google Drive