fix: kuber plugin pass id token on getClusters req
Signed-off-by: rgorkovenko <rodiongork@github.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user