diff --git a/.changeset/honest-jokes-rush.md b/.changeset/honest-jokes-rush.md new file mode 100644 index 0000000000..31ec6202da --- /dev/null +++ b/.changeset/honest-jokes-rush.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-auth-backend': patch +--- + +Use .text instead of .json for ALB key response diff --git a/plugins/auth-backend/src/providers/aws-alb/provider.test.ts b/plugins/auth-backend/src/providers/aws-alb/provider.test.ts index 284dca1a6e..bae809971e 100644 --- a/plugins/auth-backend/src/providers/aws-alb/provider.test.ts +++ b/plugins/auth-backend/src/providers/aws-alb/provider.test.ts @@ -36,7 +36,7 @@ jest.mock('cross-fetch', () => ({ __esModule: true, default: async () => { return { - json: async () => { + text: async () => { return mockKey(); }, }; diff --git a/plugins/auth-backend/src/providers/aws-alb/provider.ts b/plugins/auth-backend/src/providers/aws-alb/provider.ts index 7003354077..41dc5cf916 100644 --- a/plugins/auth-backend/src/providers/aws-alb/provider.ts +++ b/plugins/auth-backend/src/providers/aws-alb/provider.ts @@ -102,7 +102,7 @@ export class AwsAlbAuthProvider implements AuthProviderRouteHandlers { } const keyText: string = await fetch( `https://public-keys.auth.elb.${this.options.region}.amazonaws.com/${keyId}`, - ).then(response => response.json()); + ).then(response => response.text()); const keyValue = crypto.createPublicKey(keyText); this.keyCache.set(keyId, keyValue); return keyValue;