googleworkspace / googleworkspace/apps-script-samples
data-studio/auth.gs doesn't guarantee authorisation.
Nobody has claimed this yet.
- 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:
- State that the hasAccess() method does not guarantee authorisation as it states in the documentation.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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