awslabs / awslabs/agentcore-samples

Add harness sample: JWT inbound auth + OAuth-protected gateway

Open
#1,397 0 comments 0 reactions 1 assignee Claimed by @akshseh View on GitHub
01-tutorials bug
Dominant language
Python
Stars
3.4k
Forks
1.3k
Avg merge
1d 22h
Merged PRs (30d)
30

Description

## Summary

Add a sample notebook demonstrating AgentCore harness with end-to-end OAuth integration:
- **Inbound auth**: CUSTOM_JWT authorizer on the harness (Cognito user pool, USER_PASSWORD_AUTH)
- **Outbound auth**: OAuth client credentials grant to authenticate to an AgentCore Gateway via a credential provider in AgentCore Identity

## What the sample covers

- Configuring `authorizerConfiguration.customJWTAuthorizer` on a harness
- Configuring `outboundAuth.oauth` on a gateway tool with `CLIENT_CREDENTIALS` grant
- Registering an OAuth2 credential provider in AgentCore Identity
- Creating a Gateway with CUSTOM_JWT inbound auth and a Lambda target
- Invoking the harness with a bearer token via the HTTPS endpoint
- Full cleanup (discover-by-name, idempotent)

## Files

- `harness_oauth_gateway.ipynb` — main notebook (focused on harness auth)
- `utils/setup_helpers.py` — idempotent infra setup functions (Cognito, Lambda, Gateway, IAM)
- `utils/lambda_function_code.py` — order management Lambda handler
- `images/architecture.jpg` — architecture diagram

## Proposed location

[agentcore-samples] - [01-tutorials] - [11-AgentCore-harness] - [01-advanced-examples] - [07-oauth]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.