feat(core): port xAI SuperGrok OAuth to v2#36430
Open
watzon wants to merge 1 commit into
Open
Conversation
Register browser PKCE and headless device-code SuperGrok login methods on the v2 XAI plugin, with refresh that falls back when refresh_token is omitted and expires derived from expires_in or JWT exp. Closes anomalyco#34778
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 for this PR
Closes #34778
Type of change
What does this PR do?
Ports SuperGrok subscription login from V1 into the V2
XAIPlugin, soxaiexposes the same OAuth methods users already know:xAI Grok OAuth (SuperGrok Subscription)(PKCE + pinned127.0.0.1:56121callback, Grok-CLI client id,plan=generic/referrer=opencode)xAI Grok OAuth (Headless / Remote / VPS)(RFC 8628 withauthorization_pending/slow_downbackoff)Token refresh is registered on both methods and runs through V2
Integration.connection.resolve(with refresh-token rotation fallback when the token endpoint omitsrefresh_token). Credential expiry prefers a positiveexpires_in, else JWTexp, else a 1h default, with a 120s skew so resolve refreshes before mid-flight expiry. The runner continues to injectcredential.accessas the bearer — no V1-style fetch monkey-patch.API key / env methods still come from models-dev.
How did you verify your code works?
bun typecheckfrompackages/corebun test test/plugin/provider-xai.test.tsfrompackages/core— 15 pass (registration, authorize URL helpers, refresh omit/rotate, JWT expires, device pending/slow_down/denied, full integration connection login against a mock server)bun turbo typecheck --concurrency=3— all packages passedScreenshots / recordings
Not a UI change.
Checklist