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

For GitHub plugins, use scmAuthApi instead of githubAuthApi #1698

Open
ltdonner-bah opened this issue Oct 24, 2024 · 3 comments
Open

For GitHub plugins, use scmAuthApi instead of githubAuthApi #1698

ltdonner-bah opened this issue Oct 24, 2024 · 3 comments
Labels
kind/enhancement New feature or request

Comments

@ltdonner-bah
Copy link

Feature Suggestion

We have some repositories in a GitHub Enterprise Server instance and some on github.com
For GitHub plugins (in our case the Pull Requests and GitHub Insights plugins) we can only use the plugins for one or the other.
This feature suggestion is to alter how tokens are retrieved in order to be able to use these plugins for multiple GitHub instances.

Possible Implementation

https://github.com/RoadieHQ/roadie-backstage-plugins/blob/main/plugins/frontend/backstage-plugin-github-pull-requests/src/components/useGithubLoggedIn.tsx#L36

Something like this but more tweaking needed to get it to work with what you have here, but kinda the gist of it:

  const scmAuthApi = useApi(scmAuthApiRef);
  const [isLoggedIn, setIsLoggedIn] = useState(false);

  useEffect(() => {
    const token = (
    await auth.getCredentials({
      url: `https://${host}`,
      additionalScope: { customScopes: { github: ['repo'] } },
    })
  ).token;

Context

We need to use multiple GitHub providers. In order to do this, we followed the Backstage maintainer suggestion of using the scmAuthApi to accomplish this - the original issue on the Backstage side is here:
backstage/backstage#18887 (comment)

We followed the custom SCMAuthApi implementation detailed in the docs here https://backstage.io/docs/auth/#custom-scmauthapi-implementation

For our own plugins we were able to switch from the githubAuthApi to scmAuthApi to be able to view GitHub information from both locations using the appropriate user tokens. Now we'd love to still be able to use Roadie plugins for both as well.

@ltdonner-bah ltdonner-bah added the kind/enhancement New feature or request label Oct 24, 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 Dec 23, 2024
@ltdonner-bah
Copy link
Author

unstale, please

@github-actions github-actions bot removed the stale label Dec 23, 2024
@GeorgeWestwater
Copy link

bumping this feature, this would be very helpful for me as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants