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

Github token and scope not being requested/add correctly to the GH request for the read me file #1119

Open
renatafaracobah opened this issue Sep 12, 2023 · 12 comments
Labels
kind/bug Something isn't working

Comments

@renatafaracobah
Copy link

Expected Behavior

  • For public github.com repositories, the request for the readme file should not add the GH token to the Authorization header if the token is for a GitHub Enterprise instance.
  • For internal/private repositories, if the user doesn’t have the required scope (repo), the GH login page should be prompt so the user can authorize access to the new scope.
    login-popup

Current Behavior

  • For public github.com repositories, the request for the readme file is always embedding the GH token even if the token is for an enterprise instance, which can provoke an error response Bad Credentials ( example: https://api.github.com/repos/boozallen/sdp-libraries/readme )
  • For internal/private repositories, if the user doesn’t have the required scope, the card shows the message: Not found and does not prompt the user to log in to update the scope.

Steps to Reproduce

  1. Login to backstage using GitHub enterprise credentials

  2. Given an entity located in a public repository in GitHub (github.com), add the Readme card to that entity’s page.

  3. Go to the page: it shows the Readme card with the error: Bad credentials.
    bad-credentials-public-repo

  4. Login to backstage using the GitHub credentials and configure the scope to only read:user

  5. Go to an entity page that has the Readme card configured: it shows the card with the error: Not Found.
    token-only-user-scope

  6. If you go to the same page, now adding the repo scope to the X-Oauth-Scopes header, the card is shown correctly:
    token-repo-scope

Possible Solution

Context

We are using the GH Insights Roadie plugin to display the Readme file for several entities (components, systems, domains, templates) to encourage our users to go to the docs and find more information.

Your Environment

  • @backstage/plugin-catalog-react version: ^1.8.3
  • @backstage/integration version: ^1.6.2
  • @roadiehq/backstage-plugin-github-insights version: ^2.3.20
@renatafaracobah renatafaracobah added the kind/bug Something isn't working label Sep 12, 2023
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Nov 11, 2023
@ltdonner-bah
Copy link

unstale please

@github-actions github-actions bot removed the stale label Nov 13, 2023
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jan 12, 2024
@ltdonner-bah
Copy link

unstale please

@github-actions github-actions bot removed the stale label Jan 12, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Mar 12, 2024
@ltdonner-bah
Copy link

unstale please

@github-actions github-actions bot removed the stale label Mar 12, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label May 11, 2024
@jladd-bah
Copy link

unstale please

@github-actions github-actions bot removed the stale label May 13, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jul 12, 2024
@jladd-bah
Copy link

unstale please

@github-actions github-actions bot removed the stale label Jul 12, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Sep 10, 2024
@jladd-bah
Copy link

unstale please

@github-actions github-actions bot removed the stale label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants