Google spreadsheet api Request had insufficient authentication scopes

google sheets api
google drive api scopes
permission_denied: request had insufficient authentication scopes.
gcloud request had insufficient authentication scopes
request had insufficient authentication scopes bigquery
google sheets api v4 python
google apis::clienterror insufficientpermissions request had insufficient authentication scopes
request had insufficient authentication scopes autorclone

I'm making an script to read data from google spreadsheet using the following script on nodejs:

var url = oauth2Client.generateAuthUrl({
    access_type:     'offline',
    approval_prompt: 'force',
    scope: [
      'https://www.googleapis.com/auth/analytics.readonly',
      'https://www.googleapis.com/auth/drive',
      'https://www.googleapis.com/auth/spreadsheets'
    ]
});
global.googleapis = { expiry_date: 0 };
google.options({ auth: oauth2Client });
var sheets    = google.sheets('v4');
sheets.spreadsheets.get({ spreadsheetId: 'id'}, function(err, data) {
    res.send(err, data);
});

But on every get request i'm getting this error:

Request had insufficient authentication scopes.

I checked the Google developers console to enable the Google Drive API and it's enabled, so I dont really know what could it be.

  1. Firstly delete the credentials files ~/.credentials/sheets.googleapis.com-nodejs-quickstart.json (depending on your setting)

  2. Change the scope variable used for reading cells from Google Spreadsheets from

var SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly'];

to

var SCOPES = ['https://www.googleapis.com/auth/spreadsheets'];

  1. After the execution of code, API will authenticate again and then the issue will be resolved.

google api (sheets) Request had insufficient authentication scopes , SCOPES must be of type list. SCOPES = ['https://www.googleapis.com/auth/​spreadsheets', "https://www.googleapis.com/auth/drive.file",  First, make sure you also enable the Sheets API in your Developers Console. The insufficient authentication scopes is an error in the OAuth 2.0 token provided in the request specifies scopes that are insufficient for accessing the requested data.

The scopes look good, maybe you should try to remove the credentials stored previously in /Users/yourUserName/.credentials/sheets.googleapis.com-projectName/*, and then execute the application again to get new credentials.

PHP, spreadsheet : Request had insufficient authentication scopes #1396 I started with the PHP Quickstart example from the Google Slides API  Google Cloud vision API: “Request had insufficient authentication scopes.” 29 403 “Request had insufficient authentication scopes” during gcloud container cluster get-credentials

Error in updating rows Google Sheets API · Issue #776 · googleapis , I try to update rows in Google Sheets, but have error 403 Request had insufficient authentication scopes. [403] Errors [Message[Request had  Google People API gapi.client.people.people.connections.list returns Request had insufficient authentication scopes 0 Access Api created google spreadsheet on Browser

In my case a token.pickle file was created in the same working directory as my program, I also had my credentials.json file in the same directory, all I did was deleted the token.pickle file , then changed the scope, then ran it again, it will again ask for authentication in your browser and that's it , it works.

My code snippet is like below , I was creating a pickle file so I had to delete it before changing scope

    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(
                'credentials.json', SCOPES)
            creds = flow.run_local_server()
        # Save the credentials for the next run
        with open('token.pickle', 'wb') as token:
            pickle.dump(creds, token)

Getting error 403 while aceesing any API, First, make sure you also enable the Sheets API in your Developers Console. The insufficient authentication scopes is an error in the OAuth 2.0 token provided​  google.api_core.exceptions.PermissionDenied: 403 Request had insufficient authentication scopes. Note: Google SPeech API is enabled and I am using Python 3.6 Here is the code, thank you for your help.

The same problem occurred when I updated the scope. Along with the instruction, I delete the token.json file under the same directory with the python script, then the Authentication scope issue went away.

Authorize Requests | Sheets API, Google spreadsheet api Request had insufficient authentication scopes. Posted by: admin December 20, 2017 Leave a comment. Questions: I'm making an  Activate the Google Sheets API in the Google API Console. (If the API isn't listed in the API Console, then skip this step.) When your application needs access to user data, it asks Google for a particular scope of access. Google displays a consent screen to the user, asking them to authorize your application to request some of their data. If the user approves, then Google gives your application a short-lived access token.

"Request had insufficient authentication scopes.", Google spreadsheet api Request had insufficient authentication scopes scope: [ 'https://www.googleapis.com/auth/analytics.readonly', This document lists the OAuth 2.0 scopes that you might need to request to access Google APIs, depending on the level of access you need. Sensitive scopes require review by Google and have a sensitive indicator on the Google Cloud Platform (GCP) Console's OAuth consent screen configuration page. Many scopes overlap, so it's best to use a scope that isn't sensitive.

The Google My Business API requires the following OAuth 2.0 scope: https://www​.googleapis.com/auth/plus.business.manage. For information on this requirement, see Google API Services: User Data Policy. These scopes do not require a security assessment. Restricted—These scopes provide wide access to Google User Data and require you to go through a restricted scope verification process. For information on this requirement, see Google API Services: User Data Policy and Additional Requirements for Specific API Scopes. If you store restricted scope data on servers (or transmit), then you need to go through a

About authorization protocols; Authorizing requests with OAuth 2.0 Here's the OAuth 2.0 scope information for the Google Sheets API:  What I want to achieve? Is sending form data to Google spreadsheet using PHP and POST method! This is the code that I used, did I use it in the wrong way?

Comments
  • This answers the question in the most straightforward fashion (and explains why the error occurs in the first place)!
  • You don't have to delete the credentials.json, only remove token.js and change scope in nodejs project. Then you need to do that link authentication again.
  • Deleting the json file does nothing. I had to delete the token.json directory NOT the json credential file. Now it actually works.
  • This relieved a massive and growing headache. Thanks, Long and J-Ho!