Support custom token response parsing for non-standard OAuth providers - #9
Merged
Conversation
…access Introduce a TokenResponseFields struct and TokenResponse::into_fields() conversion so that exchange_code() and exchange_refresh_token() work through an intermediate fields struct rather than accessing TokenResponse directly. This prepares for allowing custom token response types in a follow-up commit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Support providers like Slack that nest tokens inside sub-objects by allowing callers to specify a custom deserialization type via `.token_response_type::<R>()` on the builder. The type must implement `DeserializeOwned + Into<TokenResponseFields>`. - Add `TokenResponseFields` as the canonical token response struct with builder-style construction (`new(access_token).with_*()`) - Default path deserializes `TokenResponseFields` directly (no intermediate type needed for standard OAuth 2.0 responses) - Add `TokenParse` error variants to `AuthError` and `RefreshError` - Add `FakeOAuthServer::start_with_nested_response` for testing - Use `checked_add` for `expires_in` expiry calculation - Include response body in refresh token parse errors (parity with auth code exchange) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ed scopes PageContext.scopes() was passing the builder-configured scopes to the success page renderer instead of the scopes resolved from the token response (per RFC 6749 §5.1). This caused the success page to show requested scopes even when the provider granted a different set. Also adds FakeOAuthServer::start_with_scope() for testing providers that return an explicit scope in the token response. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Demonstrates handling Slack's deviations from RFC 6749: nested authed_user response, comma-delimited scopes, non-standard user_scope parameter, and HTTPS redirect requirement. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
No description provided.