Closed alexef closed 1 week ago
The following package(s) are changed by this PR but do not have a changeset:
See CONTRIBUTING.md for more information about how to add changesets.
Package Name | Package Path | Changeset Bump | Current Version |
---|---|---|---|
@backstage/core-app-api | packages/core-app-api | none | v1.12.5 |
@backstage/core-plugin-api | packages/core-plugin-api | none | v1.9.2 |
@backstage/test-utils | packages/test-utils | none | v1.5.5 |
@backstage/plugin-scaffolder | plugins/scaffolder | none | v1.20.0 |
@backstage/plugin-techdocs | plugins/techdocs | none | v1.10.5 |
@aramissennyeydd / @freben pulling you from the original ticket, can you have a look and see if this would be an acceptable approach?
I can implement it as an eventSourceApi
as you suggested, but I wouldn't want to duplicate the header.name configuration in FetchMiddlewares.injectIdentityAuth.
Not yet sure, but I assume if the new eventSourceApi
depended on the fetchApi
, then it could call the new fetchApi.headers?
method so the configuration is done only once.
My current code looks like this:
createApiFactory({
api: fetchApiRef,
deps: {
configApi: configApiRef,
identityApi: identityApiRef,
discoveryApi: discoveryApiRef,
},
factory: ({ configApi, identityApi, discoveryApi }) => {
return createFetchApi({
middleware: [
FetchMiddlewares.resolvePluginProtocol({
discoveryApi,
}),
FetchMiddlewares.injectIdentityAuth({
identityApi,
config: configApi,
header: {
name: 'Backstage-Authorization',
value: (backstageToken) => `Bearer ${backstageToken}`,
}
}),
],
});
},
}),
Thank you! 👍
Wanna note here as well that I think we should explore https://github.com/backstage/backstage/issues/23015#issuecomment-2117398605 before making additions to the core APIs
@Rugvip please check https://github.com/backstage/backstage/pull/24861 which should replace this PR if viable.
closing in favor of: https://github.com/backstage/backstage/pull/24861
Uffizzi Cluster pr-24820
was deleted.
PoC to validate this would be the way forward in #23015 (
scaffolder
,techdocs
useevent-source-polyfill
library that only allows headers to be passed but not the entirefetch
implementation):heavy_check_mark: Checklist
Signed-off-by
line in the message. (more info)