awslabs / awslabs/agentcore-samples
[Help] Obtain oauth2 access token from Gateway Lambda Target
- Dominant language
- Python
- Stars
- 3.4k
- Forks
- 1.3k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 30
Description
## Summary
Is there a way to use AgentCore identity to obtain an access token from a lambda function on behalf of a user who invoked AgentCore Gateway?
## Details
We have an an MCP client connecting to AgentCore Gateway, using Okta for inbound auth.
Gateway is invoking a lambda target, which means we must use IAM auth for outbound auth from the Gateway.
However our Lambda function requires access to downstream resources, like RDS / Redshift / S3.
We want to get an access token which on bahalf of the invoking user, to ensure they consent and so that RBAC configured at the resource is respected.
Is there a way to do this? Looking at the `client_context.custom` and `event` objects that are sent to the lambda there is nothing that identifies the user invoking the gateway.
## Expected Behavior
We could use AgentCore Identity to perform a 3LO flow from a lambda invoked from AgentCore Gateway.
Contributor guide
Assessment
This issue has not been assessed yet.