roadie-backstage-plugins
roadie-backstage-plugins copied to clipboard
Use github apps integration to view insights
Feature Suggestion
Use the github apps integration if it exists in the application configuration to view contents of insights and make it configure not to do so if i should want to keep the existing behavior.
Possible Implementation
Use the integration if it exists, or make it configure not to do so if i want to keep the existing behavior.
Context
Today it seems that the insights plugin is making the user sign in to github in order to view repository insights. I'd like to avoid that as i have only setup github apps integration to authenticate towards github and use a SSO solution to authentiacate and authorize the user in backstage.
I was able to get it going with the following overwrite to the default githubAuthApiRef within packages/app/src/api.ts:
//packages/app/src/api.ts
import {
AnyApiFactory,
configApiRef,
createApiFactory,
discoveryApiRef,
githubAuthApiRef,
oauthRequestApiRef,
} from '@backstage/core-plugin-api';
import { GithubAuth } from '@backstage/core-app-api';
export const apis: AnyApiFactory[] = [
...
createApiFactory({
api: githubAuthApiRef,
deps: {
discoveryApi: discoveryApiRef,
oauthRequestApi: oauthRequestApiRef,
configApi: configApiRef,
},
factory: ({ discoveryApi, oauthRequestApi, configApi }) =>
GithubAuth.create({
configApi,
discoveryApi,
oauthRequestApi,
defaultScopes: ["read:user", "read:org", "repo"],
environment: configApi.getOptionalString('auth.environment'),
}),
})
];
This fixed my issue. You should see some logs like this:
"GET /api/auth/github/start?scope=read%3Auser%20user%3Aemail%20read%3Aproject&origin=http%3A%2F%2Flocalhost%3A3000&flow=popup&env=development HTTP/1.1"
I was able to get it going with the following overwrite to the default githubAuthApiRef within packages/app/src/api.ts:
... createApiFactory({ api: githubAuthApiRef, deps: { discoveryApi: discoveryApiRef, oauthRequestApi: oauthRequestApiRef, configApi: configApiRef, }, factory: ({ discoveryApi, oauthRequestApi, configApi }) => GithubAuth.create({ configApi, discoveryApi, oauthRequestApi, defaultScopes: ["read:user", "read:org", "repo"], environment: configApi.getOptionalString('auth.environment'), }), }) ];
This didn't work for me. I don't use GitHub oidc/oauth to authenticate to my backstage instance in the first place so I'm not sure how much effect it should have on my auth strategy with Azure Entra and having github apps as the github-integration.
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.
Hi, I am also experiencing the same issues and would like to get this resolved. It is a neat plugin and it would be great to allow the GitHub app integration to carry forward!
p.s. the workaround did not also work for me :(