googleworkspace / googleworkspace/apps-script-samples

data-studio/auth.gs doesn't guarantee authorisation.

Open
#184 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

It's this method in question.

Expected Behavior

The code sample should either:

  1. State that the hasAccess() method does not guarantee authorisation as it states in the documentation.
  2. Include an additional code example that probes the API, and returns the authorisation state from the response code.

Description:
This code sample suggests that calling the hasAccess() method guarantees authorisation. This isn't true.

/**
 * Returns true if the auth service has access.
 * @return {boolean} True if the auth service has access.
 */
function isAuthValid() {
  return getOAuthService().hasAccess();
}

Actual Behavior

The response code needs to be handled to fully confirm authorisation state, or the documentation should suggest that the hasAccess() method doesn't guarantee authorisation. Similar to the way the call is handled in the Google Workspace Addons Documentation

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 at data-studio/auth.gs around line 157 and review the isAuthValid() example using hasAccess(). Compare its behavior and wording with the linked Google Workspace Addons Documentation. Done means either the sample clearly states that hasAccess() does not guarantee authorization or includes an example that probes the API and uses its response code.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
authentication, documentation
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.