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개 답변
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
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠