From 39b05b9ae0700818feaf00390684661a4f019c82 Mon Sep 17 00:00:00 2001 From: Jonah Back Date: Fri, 22 Jan 2021 15:00:39 -0800 Subject: [PATCH] fix: use .text instead of .json for ALB key http call --- .changeset/honest-jokes-rush.md | 5 +++++ plugins/auth-backend/src/providers/aws-alb/provider.test.ts | 2 +- plugins/auth-backend/src/providers/aws-alb/provider.ts | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/honest-jokes-rush.md 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;