Getting API Usage Plan in header

0

Hello,

I have a use case to validate the Usage Plan to offer certain functionality. Could you please advise what/how I can do so every request adds Usage Plan details in the request header to my backend servers?

Thank you.

ck
已提問 2 年前檢視次數 245 次
2 個答案
0

There is no context variable that contains the usage plan, so you can't directly achieve what you want. If you use a Lambda authorizer, it can calculate the usage plan and return it in a context variable, which later can be used by a mapping template in an HTTP header.

Another option is to include the usage plan name in the API key ID, e.g., plan1-key1, plan2-key3, etc. and use $context.identity.apiKeyId in the mapping template. The backend can then retrieve the information from there.

profile pictureAWS
專家
Uri
已回答 2 年前
0

Thank you Uri for your help. The second suggestion might work. Let me check with my developer.

ck
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南