Reputation: 1363
I would like to use Api gateway as http proxy of my API restful. I use Cognito to authorize the access to the API gateway as well as my endopoint. I think to use the cognito identity id to identify the user but I don't know how pass this context variable to the backend for each request (GET, POST, PUT...)
Can you help me?
Thank you Agostino
Upvotes: 3
Views: 1377
Reputation: 4152
Define a request mapping template and use "$context.identity.cognitoIdentityId" to get the cognito identity ID.
i.e.
{
"cognito-identity" : "$context.identity.cognitoIdentityId"
}
This will send the identity ID in the request body.
You could also send in a HTTP parameter by using "context.identity.cognitoIdentityId" in your parameter mapping expression.
Upvotes: 2