googleworkspace / googleworkspace/apps-script-samples

Trouble on the quickstart using app script

Open
#159 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
5.2k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

Expected Behavior

Hey guys,

I followed tutorial on google app script quick start for gmail API here

What i'm getting in the app script is this

GoogleJsonResponseException: API call to gmail.users.labels.list failed with error: Request had insufficient authentication scopes. (line 5, file "Code")

The code followed is exactly the same as the tutorial, I also enabled gmail in Resources > Advance Google Service

/**
 * Lists the labels in the user's account.
 */
function listLabels() {
  var response = Gmail.Users.Labels.list('me');
  if (response.labels.length == 0) {
    Logger.log('No labels found.');
  } else {
    Logger.log('Labels:');
    for (var i = 0; i < response.labels.length; i++) {
      var label = response.labels[i];
      Logger.log('- %s', label.name);
    }
  }
}

I thought its going to be easier for me to integrate stuff in google ecosystem. Right now my other way is to create my own server and use node js to use gmail api. can anyone help me please?

Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Gmail API Apps Script quickstart linked in the issue and reproduce the failure using the provided listLabels function. Check the sample's authentication and Advanced Google Service setup, then compare the observed scopes with the quickstart's expected behavior. Done means the sample runs without the insufficient-authentication-scopes error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.