Repository navigation
feat(auth): model the token broker — POST /auth/v1/broker/<provider>[/<integration>] - #82
Merged
Merged
Conversation
auth.broker.token(provider, integration=None, min_scopes=None) POSTs
/auth/v1/broker/<provider>/ or /auth/v1/broker/<provider>/<integration>/
with {min_scopes} when given. campus-classroom currently raw-requests
this endpoint and hand-maps error statuses; through the JsonClient the
errors arrive as APIError subclasses (403 details.missing_scopes, 401
AuthenticationError, 400 AUTH_INVALID_SCOPE) via raise_for_status.
Fixes #72
nycomp
force-pushed
the
feat/auth-broker
branch
from
October 4, 2026 01:47
b7cd9a4 to
76bf478
Compare
This was referenced Oct 4, 2026
ngjunsiang
added this pull request to stack #86
October 4, 2026 03:05
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.
Summary
auth.brokerresource:broker.token(provider, integration=None, *, min_scopes=None)/auth/v1/broker/<provider>//auth/v1/broker/<provider>/<integration>/(e.g.google+classroom){"min_scopes": [...]}when given,{}otherwise — matching what campus-classroom sends todayAPIErrorsubclasses throughraise_for_status()— 404 not-connected →NotFoundError, 401 session-expired →AuthenticationError, 403 withdetails.missing_scopes, 400AUTH_INVALID_SCOPE— so campus-classroom can drop its hand-rolled status mapping (classroom_auth.py:288-293).Tests
tests/unit/test_broker.py— 4 contract tests pinning both route paths, empty-body vsmin_scopesbodies. Full suite: 156 passed.Fixes #72