fix: kuber plugin pass id token on getClusters req

Signed-off-by: rgorkovenko <rodiongork@github.com>
This commit is contained in:
rgorkovenko
2021-11-09 10:07:22 +03:00
parent 58d0c50d5d
commit 9f3dd76bc7
2 changed files with 9 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-kubernetes': patch
---
fix: kubernetes plugin shall pass id token on get clusters request if possible
@@ -79,10 +79,14 @@ export class KubernetesBackendClient implements KubernetesApi {
}
async getClusters(): Promise<{ name: string; authProvider: string }[]> {
const idToken = await this.identityApi.getIdToken();
const url = `${await this.discoveryApi.getBaseUrl('kubernetes')}/clusters`;
const response = await fetch(url, {
method: 'GET',
headers: {
...(idToken && { Authorization: `Bearer ${idToken}` }),
},
});
return (await this.handleResponse(response)).items;