backstage/community-plugins

๐Ÿ› stack-overflow: Use built in fetch to ensure correct authentication is used

ScottGuymer opened this issue ยท 1 comments

Plugin Name

stack-overflow

๐Ÿ“œ Description

We have a private stackoverflow for teams instance.

To enable this plugin to work we configure a proxy config in backstage that injects authentication to the SO API.

The frontend SO plugin then uses this proxy API to speak to SO.

With authentication on proxy APIs now being default it causes errors as this plugin does not inject the authentication and the proxy api returns a 401.

๐Ÿ‘ Expected behavior

The plugin should use the built in fetch API that will detect that a proxy request is being made back to backstage itself and inject the correct auth.

The line here -
https://github.com/backstage/community-plugins/blob/main/workspaces/stack-overflow/plugins/stack-overflow/src/api/StackOverflowClient.ts#L51 needs to be updated to use the backstage FetchAPI which should automatically detect that it is calling backstage itself and inject the correct authentication.

In line with https://backstage.io/docs/architecture-decisions/adrs-adr013/

๐Ÿ‘Ž Actual Behavior with Screenshots

Proxy returns 401 and the plugin shows no questions.

๐Ÿ‘Ÿ Reproduction steps

  • Create proxy configuration for SO
  • try and retrieve questions from this via the plugin

๐Ÿ“ƒ Provide the context for the Bug.

No response

๐Ÿ‘€ Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find similar issue

๐Ÿข Have you read the Code of Conduct?

Are you willing to submit PR?

Yes I am willing to submit a PR!