How to pass Header from Step function to API Gateway

0

Hello All,

I have a step function that calls a JIRA Create Issue REST API which is registered in the API gateway. The JIRA API requires an Authentication token to be passed as an Header.

However, when I invoke the API from the Step function, I am unable to pass the Authorization token to the Endpoint request header. Since the parameter "Authorization" is not allowed in the Step function, I had to provide a different parameter name.

I can see that, from CloudWatch logs, that the Authorization header is being passed to the Method request, but I am not able to map it to the Integration request.

Step function Definition:

{ "Comment": "Call the JIRA API", "StartAt": "Call Create Issue JIRA", "States": { "Call Create Issue JIRA": { "Type": "Task", "Resource": "arn:aws:states:::apigateway:invoke", "InputPath": "$", "Parameters": { "ApiEndpoint": "1biic9mt41.execute-api.ap-south-1.amazonaws.com", "Method": "POST", "Stage": "stage", "Path": "createissue", "Headers": { "AuthCode": ["Basic <Authcode encoded in base64>"] }, "AuthType": "IAM_ROLE", "RequestBody.$": "$" }, "End": true } }

I have created the "AuthCode" in the HTTP header in Method Request of the API and mapped the same in the HTTP header section of the Integration request.

I could not see the HTTP header in the Endpoint request headers section.

I am new to this and learning as I go, so any help is appreciated on how to achieve this

1 Antwort
0

Map of request query string parameters and headers that should be passed to the backend responder using request_parameters in api gateway integration . For example: request_parameters = { "integration.request.header.X-Some-Other-Header" = "method.request.header.X-Some-Header" }

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-integration-requestParameters.html

https://aws.amazon.com/premiumsupport/knowledge-center/custom-headers-api-gateway-lambda/#:~:text=To%20pass%20custom%20headers%20from,from%20the%20original%20API%20request.

AWS
SIVA
beantwortet vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen