Title: Add xAI (Grok) OAuth app connector · Issue #423 · onecli/onecli · GitHub
Open Graph Title: Add xAI (Grok) OAuth app connector · Issue #423 · onecli/onecli
X Title: Add xAI (Grok) OAuth app connector · Issue #423 · onecli/onecli
Description: Hi maintainers 👋 Feature request: Add xAI / Grok as an OAuth app connector, so users can connect their xAI account through OneCLI and have the gateway inject refreshed xAI OAuth credentials for requests to api.x.ai. Motivation: OneCLI su...
Open Graph Description: Hi maintainers 👋 Feature request: Add xAI / Grok as an OAuth app connector, so users can connect their xAI account through OneCLI and have the gateway inject refreshed xAI OAuth credentials for req...
X Description: Hi maintainers 👋 Feature request: Add xAI / Grok as an OAuth app connector, so users can connect their xAI account through OneCLI and have the gateway inject refreshed xAI OAuth credentials for req...
Opengraph URL: https://github.com/onecli/onecli/issues/423
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add xAI (Grok) OAuth app connector","articleBody":"Hi maintainers 👋\n\n**Feature request:** Add xAI / Grok as an OAuth app connector, so users can connect their xAI account through OneCLI and have the gateway inject refreshed xAI OAuth credentials for requests to `api.x.ai`.\n\n**Motivation:** OneCLI supports OAuth connectors for GitHub/Google/Gmail/Resend and API-key secrets, but there's no first-class xAI/Grok connector. With Grok increasingly used by CLI/agent tooling, a native vault-injected, auto-refreshing connector would be valuable.\n\n**Status:** I have a complete, working, tested implementation ready — happy to open the PR as soon as there's agreement on the design questions below.\n\n**How it's currently implemented:**\n- **TS/API** (`packages/api/src/apps/xai.ts` + `types.ts`, `routes/apps.ts`, `apps/registry.ts`, `app-permissions/xai.ts`, provider icon): registers the `xai` connector (host `api.x.ai`, `Authorization: Bearer {value}` injection).\n- **Two OAuth flows:**\n - *Authorization-code + PKCE* (`S256`) through the existing `/v1/apps/:provider/authorize` → `/callback` dashboard UX (added a `pkce` flag to `ConnectionMethod` + a server-held verifier cookie).\n - *RFC 8628 device-code* via new `POST /v1/apps/xai/device-code` (start) + `/device-code/exchange` (poll) — agent/CLI-friendly.\n- **Rust gateway** (`apps/gateway/src/apps.rs`, `connect.rs`): provider registration + **public-client refresh** (form-encoded `client_id` + `refresh_token`, *no* `client_secret`, since xAI is a public OIDC client).\n- xAI OIDC endpoints: `auth.x.ai/oauth2/{authorize,device/code,token,userinfo,revoke}`; discovery confirms `authorization_code`, `refresh_token`, device-code, `none` auth method, and PKCE `S256`.\n\n**Verification (all green):**\n- `pnpm check` (typecheck) + `pnpm build` pass.\n- Tests: **283 API (Vitest) + 470 Rust gateway unit + 8 integration** pass; added mocked tests for authorize, token exchange, device-code start/poll/exchange, and gateway public-client refresh.\n- **End-to-end verified locally:** device-code login with a real xAI account → token stored in the vault → a real `grok-4.3` chat call routed through the gateway returned a correct response using the injected OAuth Bearer.\n- Branch is squashed to a single Conventional Commit; no CLA/DCO required per the repo.\n\n**Design questions before I open the PR:**\n1. **Client ID:** xAI exposes a public OAuth client for its official grok CLI. Prefer the connector to default to that public client id (overridable via config / `XAI_CLIENT_ID`), like several CLI OAuth integrations reuse public clients — or require users to bring their own?\n2. **Flows:** ship both auth-code+PKCE and device-code, or just the dashboard PKCE flow?\n\n**Note:** grok model region-availability (some models are restricted by region) is a runtime/inference concern for callers, not a connector concern — the connector only handles OAuth, refresh, and gateway injection.\n\nThanks! Happy to open the PR immediately on a thumbs-up.\n","author":{"url":"https://github.com/robbyczgw-cla","@type":"Person","name":"robbyczgw-cla"},"datePublished":"2026-07-09T08:11:06.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/423/onecli/issues/423"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f2b19206-75d7-ee75-26e7-7c32ae9d319a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B8E4:1DF241:5B311AB:78202C7:6A5DB663 |
| html-safe-nonce | 0f759dbff939a61bd5439a3b0781fe270384e3dc0ceaab403fdd4a6dda9a2c02 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOEU0OjFERjI0MTo1QjMxMUFCOjc4MjAyQzc6NkE1REI2NjMiLCJ2aXNpdG9yX2lkIjoiNDAzOTEyNTY2OTQ0MzkwOTIxOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1abced37d5d9f2fbbeb48b2863eaf54b2d06ea4c95872594ae1062bed8a11ff9 |
| hovercard-subject-tag | issue:4844477311 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/onecli/onecli/423/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ec681929b56733e9ae8745a6a307598f742c50c26be72b5aa8426e527f53c519/onecli/onecli/issues/423 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ec681929b56733e9ae8745a6a307598f742c50c26be72b5aa8426e527f53c519/onecli/onecli/issues/423 |
| og:image:alt | Hi maintainers 👋 Feature request: Add xAI / Grok as an OAuth app connector, so users can connect their xAI account through OneCLI and have the gateway inject refreshed xAI OAuth credentials for req... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | robbyczgw-cla |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/onecli/onecli git https://github.com/onecli/onecli.git |
| octolytics-dimension-user_id | 263660444 |
| octolytics-dimension-user_login | onecli |
| octolytics-dimension-repository_id | 1175900220 |
| octolytics-dimension-repository_nwo | onecli/onecli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1175900220 |
| octolytics-dimension-repository_network_root_nwo | onecli/onecli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width