Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some HTTP 403 errors offer context #1929

Open
aronatkins opened this issue Dec 13, 2023 · 0 comments
Open

Some HTTP 403 errors offer context #1929

aronatkins opened this issue Dec 13, 2023 · 0 comments
Labels
feature a feature request or enhancement git git, GitHub, and CI in general

Comments

@aronatkins
Copy link

Using usethis 2.2.2, I struggled to understand why a refreshed GitHub token was not usable. Even after the token-update dance, I was still seeing errors like the following from usethis::use_release_issue():

Error: Unable to get GitHub info for these remotes: 'origin'
Are we offline? Is GitHub down? Has the repo been deleted?
Otherwise, you probably need to configure a personal access token (PAT) for 'github.com'
See `?gh_token_help` for advice

The feedback from usethis::git_sitrep() was similar:

• Desc = 'origin' is a GitHub repo and 'upstream' is either not configured or is not a GitHub repo.
  
  We may be offline or you may need to configure a GitHub personal access
  token. `gh_token_help()` can help with that.
  
  Read more about what this GitHub remote configurations means at:
  'https://happygitwithr.com/common-remote-setups.html'

I did not uncover any actionable feedback until digging into the lower-level calls made by usethis. Directly calling gh::gh() gave me:

Error in `gh::gh()`:
! GitHub API error (403): Resource protected by organization SAML enforcement. You must
  grant your Personal Access token access to this organization.
ℹ Read more at
  <https://docs.github.com/articles/authenticating-to-a-github-organization-with-saml-single-sign-on/>
Run `rlang::last_trace()` to see where the error occurred.

This was enough of a reminder - our SSO needs tokens to be authorized (a separate step after creation / refresh).

Is it possible for context about the original error to be provided to some of the higher-level calls?

@jennybc jennybc added feature a feature request or enhancement git git, GitHub, and CI in general labels Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement git git, GitHub, and CI in general
Projects
None yet
Development

No branches or pull requests

2 participants