sindresorhus/refined-github

Do you want to work on this issue?

You can request for a bounty in order to promote it!

API actions might fail silently #4828

sambostock posted onGitHub

Please ensure:

  • The bug is caused by Refined GitHub. It doesn't happen if I disable the extension.

Description

On private repositories that are part of a private GitHub org using SAML auth, some features do not work if the token has not been authorized.

This is expected, as there is no workaround other than giving the token access. However, ideally the error would be gracefully handled and feedback given to the user.

For example, when attempting to use the x to quickly remove a label from an issue, the button simply appears to do nothing. Opening the Console reveals that the

DELETE /repos/ORG/REPO/issues/NUMBER/labels/LABEL

request failed with an unhandled 403 response:

Uncaught (in promise) Error: Unable to fetch.
Ensure that your token has access to this repo.
{
    "message": "Resource protected by organization SAML enforcement. You must grant your Personal Access token access to this organization.",
    "documentation_url": "https://docs.github.com/articles/authenticating-to-a-github-organization-with-saml-single-sign-on/"
}

Ideally,

  • either the features that wouldn't work would just not load
    • and maybe a message would be shown explaining why
  • or the user would be notified of the error in some way, with steps to resolve it (as provided by GitHub's response)

Screenshot

No response

Console errors

VM256 refined-github.js:2930 DELETE https://api.github.com/repos/ORG/REPO/issues/12345/labels/LABEL 403
mem.cacheKey @ VM256 refined-github.js:2930
async function (async)
mem.cacheKey @ VM256 refined-github.js:2926
(anonymous) @ VM256 refined-github.js:2857
removeLabelButtonClickHandler @ VM256 refined-github.js:8507
listenerFn @ VM256 refined-github.js:1682
VM256 refined-github.js:2906 Uncaught (in promise) Error: Unable to fetch.
Ensure that your token has access to this repo.
{
    "message": "Resource protected by organization SAML enforcement. You must grant your Personal Access token access to this organization.",
    "documentation_url": "https://docs.github.com/articles/authenticating-to-a-github-organization-with-saml-single-sign-on/"
}
    at getError (VM256 refined-github.js:2977)
    at async mem.cacheKey (VM256 refined-github.js:2949)
    at async HTMLHtmlElement.removeLabelButtonClickHandler (VM256 refined-github.js:8507)

Example URL

https://github.com/ORG/REPO/issues/12345

Browser(s) used

Chrome on macOS


Indeed, user actions should throw visual errors when an API call fails. Also mentioned in:

posted by fregante over 3 years ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests