Repository navigation
fix(auth): improve OAuth token lifecycle and storage reliability - #128
Open
jpsiddharth2008 wants to merge 4 commits into
Open
jpsiddharth2008 wants to merge 4 commits into
jpsiddharth2008 wants to merge 4 commits into
Conversation
Collaborator
|
Reviewed with develop ( ~sent from claude-code |
This branch has not been deployed
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.
Purpose
Closes #115.
Make the OAuth client easier to use with real providers: accept string expiry values, retrieve usable access tokens automatically, and support local logout when remote revocation is unavailable. Reduce encrypted-store and lock-registry overhead while preserving existing storage compatibility and default revocation behavior.
Changes
expires_inresponses. Preserve the one-hour missing/null fallback, immediate zero expiry, and strict numeric helper APIs.revoke_token(..., local_fallback=True)to permit local deletion after a missing endpoint or remote failure. The default still retains credentials on failure. Invalid hints, storage failures and cancellation are not hidden.SecretValuein typed and mapping-based client configuration; unwrap only when constructing authentication.get_access_token(key) -> strwith expiry checks, shared refresh tasks, cancellation isolation, rotation preservation, persistence before success, and a locked recheck to prevent duplicate refreshes. Explicit refresh requests still force refresh even when joining an automatic check.File-length follow-up
Split the OAuth client types and follow-up tests into cohesive modules so this PR no longer depends on merging before #126:
nitrostack/auth/client.pynitrostack/auth/_client_types.pytests/test_oauth_client.pytests/test_oauth_client_followups.pytests/support/oauth_client.pyPR #126's checker passes these files without baseline exemptions. Existing top-level and
nitrostack.auth.clienttype imports retain object identity. AST comparisons confirm all production class/function bodies and every original test and assertion are unchanged. Shared test helpers live in a non-test support module.Validation after the file split (
b1f4dac)Validation before the file split
The initial Windows 3.12 run reached the 60-second per-test limit in the existing installed-SDK-wheel template test. A targeted run on unchanged develop reproduced a timeout in the same test. The complete Windows matrix uses a 180-second per-test limit; initial failures remain in local verification records. A matching baseline run reproduced the installed-wheel pip timeout on Python 3.12. Baseline OAuth module runs also reproduce WinError 10053: the first discovery test on Python 3.10 and the second discovery test on Python 3.12. Both OAuth discovery tests failed with WinError 10053 on the unchanged Python 3.11 baseline, including the exact test failing in the feature run. The exact first-test Python 3.12 baseline probe passed, so that individual failure was not reproduced under identical conditions. These results do not constitute an all-green Windows suite.
Compatibility
Existing callers and plaintext stores continue to work. Remote revocation remains required unless callers explicitly enable local fallback. Local deletion does not establish provider-side invalidation. Cross-process refresh-token rotation remains unsupported, as permitted by the issue.