Closed iamFIREcracker closed 1 year ago
This is supported by either specifying the agent in the additional request options: https://github.com/awslabs/aws-jwt-verify#configuring-the-jwks-response-timeout-and-other-http-options-with-jsonfetcher
Or by using your own fetcher: https://github.com/awslabs/aws-jwt-verify#using-a-different-jsonfetcher-with-simplejwkscache
Let us know if that helps
E.g. something like this:
import { CognitoJwtVerifier } from "aws-jwt-verify";
import { SimpleJwksCache } from "aws-jwt-verify/jwk";
import { SimpleJsonFetcher } from "aws-jwt-verify/https";
// please verify yourself that the following external dependency is solid,
// I'm just adding it here as an example, not an endorsement:
import { HttpsProxyAgent } from 'https-proxy-agent';
const agent = new HttpsProxyAgent('http://168.63.76.32:3128');
const verifier = CognitoJwtVerifier.create(
{
userPoolId: "<your user pool id>",
tokenUse: "access", // or "id",
clientId: "<your client id>",
},
{
jwksCache: new SimpleJwksCache({
fetcher: new SimpleJsonFetcher({
defaultRequestOptions: {
agent,
},
}),
}),
}
);
Closing for now
All the outbound traffic originated from our deployment needs to go through a private HTTP proxy, but I could not find a way to customize the library to use that proxy. Is this supported? I can see
fetchJson
accepts an optional FetchRequestOptions (which I could use to inject a custom agent); however, I don't think there is a way for a user to inject these via the plubic API?FWIW, this is the error message we are getting:
Versions