feat(auth): add OAuth2 client credentials support (alpha) - #8486
Merged
leandrodamascena merged 8 commits intoSep 30, 2026
Merged
leandrodamascena merged 8 commits into
leandrodamascena merged 8 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8486 +/- ##
===========================================
+ Coverage 96.81% 96.88% +0.06%
===========================================
Files 310 317 +7
Lines 15594 15899 +305
Branches 1361 1395 +34
===========================================
+ Hits 15098 15403 +305
Misses 361 361
Partials 135 135 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
bfreiberg
force-pushed
the
feat/auth-alpha-oauth2-8466
branch
from
September 28, 2026 07:58
a54d477 to
7c848b7
Compare
2 tasks done
leandrodamascena
force-pushed
the
feat/auth-alpha-oauth2-8466
branch
2 times, most recently
from
September 29, 2026 23:24
7c848b7 to
19e8b03
Compare
|
leandrodamascena
approved these changes
Sep 30, 2026
leandrodamascena
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the amazing work here @bfreiberg! Approved!
Contributor
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Issue number: closes #8489
Summary
Lambda functions calling an OAuth2-protected API currently need to manage token exchange, secret retrieval, token lifetimes, and concurrent refresh themselves. This adds
OAuth2Clientunderutilities.auth_alpha.oauth2Changes
client_credentialsgrant withclient_secret_basic, configurable scopes, and mutually exclusiveaudienceor RFC 8707resourceselection.auth_headers()for application-owned HTTP clients and a synchronous HTTPSrequest()helper. Disable redirects and downstream retries, reject competing Authorization headers, and use separate acquisition and downstream budgets.[oauth2]extra requiring only urllib3, dependency-isolation tests, functional and local TLS tests, Lambda examples, API documentation, and a downstream MCP example.Only client-credentials acquisition is included. Interactive grants, delegated token exchange, introspection, other client authentication methods, and a native async API remain outside this change.
User experience
Install
aws-lambda-powertools[oauth2]and configure a client outside the Lambda handler:Applications can instead obtain headers with
inventory_api.auth_headers(). The guide includes a Parameters secret loader, testing examples, and guidance on trusted destinations, secret rotation, provider resource selection, and timeout limitations. The namespace remains experimental and its API may change before GA.Validation
Validation uses a local TLS token endpoint. Live identity-provider interoperability and AWS deployment tests were not run. The documentation build retains existing warnings about unrelated links and external assets.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.