fix: use .text instead of .json for ALB key http call

This commit is contained in:
Jonah Back
2021-01-22 15:00:39 -08:00
parent d7b44f93cf
commit 39b05b9ae0
3 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-auth-backend': patch
---
Use .text instead of .json for ALB key response
@@ -36,7 +36,7 @@ jest.mock('cross-fetch', () => ({
__esModule: true,
default: async () => {
return {
json: async () => {
text: async () => {
return mockKey();
},
};
@@ -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;