feat(keycardai-oauth)!: RFC-minimal client registration and typed registration errors - #156
Merged
Merged
Conversation
…istration errors ClientRegistrationRequest no longer injects opinionated defaults (token_endpoint_auth_method, redirect_uris, grant_types, response_types, scope) and no longer requires client_name. Per RFC 7591 all client metadata is optional, so the request sends only the fields the caller sets, matching the RFC-minimal TypeScript registerClient. Registration errors are now typed: on an RFC 7591 section 3.2.2 error (HTTP 4xx with a JSON error body) registration raises OAuthProtocolError carrying the error code so a caller can branch on it, instead of an opaque OAuthHttpError with only the raw body. A non-structured 4xx still raises OAuthHttpError. Resolves the request-defaults, client_name-requiredness, and error-surfacing rows of the dynamic-client-registration spec (ECO-44).
Contributor
📦 Release PreviewThis analysis shows the expected release impact: 📈 Expected Version Changes📋 Package Details[
{
"package_name": "keycardai-oauth",
"package_dir": "packages/oauth",
"has_changes": true,
"current_version": "0.16.0",
"next_version": "0.17.0",
"increment": "MINOR"
}
]📝 Changelog PreviewThis comment was automatically generated by the release preview workflow. |
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.
The Python half of #23 DCR (ECO-44). Per your decisions: RFC-minimal request (drop Python's injected defaults) and client_name optional, plus the typed-error fix.
Changes (
keycardai-oauth)ClientRegistrationRequestno longer injectstoken_endpoint_auth_method=client_secret_basic,redirect_uris=[http://localhost:8080/callback],grant_types=[token-exchange, client_credentials],response_types=[code], orscope="read write". It inherits all metadata (optional,None) fromOAuthClientMetadataand sends only what the caller sets (model_dump(exclude_none=True)). Matches the RFC-minimal TSregisterClient.client_nameoptional: dropped theField(..., min_length=1)override (now inheritedstr | None = None) and removed the client-levelTypeError("client_name is required")checks on bothregister_clientpaths (sync + async). Aligns with RFC 7591 and TS.errorbody) registration now raisesOAuthProtocolErrorcarrying theerrorcode (previously the typed branch was unreachable for 4xx and it raised an opaqueOAuthHttpError). A non-structured 4xx still raisesOAuthHttpError.Scope
auto_register_clientconvenience path is unaffected (it passes explicit config values; it never sentresponse_types/scope, which were authorization-code fields a token-exchange client doesn't use).issuerUrl→issuerrow is already resolved by the merged ECO-33.Tests
oauth suite green (exit 0). Added: minimal request omits the dropped defaults;
client_nameomitted/empty is accepted; 4xx + RFC 7591 error body →OAuthProtocolErrorwith the parsederrorcode; non-structured 4xx →OAuthHttpError.🤖 Generated with Claude Code