Rest api gateway, custom api key header name

0

I created the objects needed to enable 'API Key Required'=true on the API gateway. But I am not able to change the default x-api-key header name. My understanding is that since the api gateway supports openapi 3.0, so in the openapi file, included into Gateway config, I added the sections:

components
    securitySchemes:
        api_key:
        type: "apiKey"
        name: "custom-header-name"
        in: "header"
security:
  - api_key: []

Unfortunately, after deploying on AWS via cloud formation, the settings are overwritten and the "x-api-key" header is still expected instead of "custom-header-name"

1 Risposta
1
Risposta accettata

As stated in the documentation "header sourced API Keys" must use the "x-api-key" header.

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-key-source.html#:~:text=key%20as%20the-,X%2DAPI%2DKey,-header%20of%20each

If you want to call the API key-required methods without explicitly supplying any API key. You can use the authorizes-sourced API Keys:

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-key-source.html#:~:text=authorizer%2Dsourced%20API%20keys

AWS
vtjean
con risposta 7 mesi fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande