diff --git a/.changeset/lovely-impalas-sell.md b/.changeset/lovely-impalas-sell.md index b52f11695c..fa3ae9d5c5 100644 --- a/.changeset/lovely-impalas-sell.md +++ b/.changeset/lovely-impalas-sell.md @@ -2,4 +2,15 @@ '@backstage/plugin-search-backend-module-explore': patch --- -Allows for an optional token manager to authenticate requests from the collator to the explore backend +Allows for an optional token manager to authenticate requests from the collator to the explore backend. For example: + +``` + indexBuilder.addCollator({ + schedule: every10MinutesSchedule, + factory: ToolDocumentCollatorFactory.fromConfig(env.config, { + discovery: env.discovery, + logger: env.logger, + tokenManager: env.tokenManager, + }), + }); +``` diff --git a/plugins/search-backend-module-explore/README.md b/plugins/search-backend-module-explore/README.md index a87f2d78f9..7d0f25b543 100644 --- a/plugins/search-backend-module-explore/README.md +++ b/plugins/search-backend-module-explore/README.md @@ -39,3 +39,18 @@ backend.add(searchPlugin()); backend.add(searchModuleExploreCollator({ schedule })); backend.start(); ``` + +### Using Auth Middleware + +If your Backstage instance uses service-to-service authentication you can pass an optional tokenManager to the collator factory. This will ensure that the collator makes authenticated requests to the explore backend. + +```tsx +indexBuilder.addCollator({ + schedule: every10MinutesSchedule, + factory: ToolDocumentCollatorFactory.fromConfig(env.config, { + discovery: env.discovery, + logger: env.logger, + tokenManager: env.tokenManager, + }), +}); +```