Skip to content

[Bug]: Grok OAuth is bypassed when cookie source is off #362

Closed

Description

@galthie

Existing issues

  • I searched existing issues and did not find a duplicate.

What happened?

On 0.54.0, with Grok authenticated via grok login (~/.grok/auth.json containing a valid OIDC entry) and the Grok cookie source set to off, the tray app permanently shows "Authentication required" for Grok. At the same time, codexbar-cli diagnose on the same machine and with the same settings succeeds via grok-oauth and returns usage data.

I traced the difference to the desktop shell's build_fetch_context in apps/desktop-tauri/src-tauri/src/commands/providers.rs:

"off" => (SourceMode::Cli, None),

When the cookie source is off, this catch-all forces SourceMode::Cli regardless of Grok's configured usage source (Auto or SuperGrok OAuth). For Grok, SourceMode::Cli calls load_credentials(GrokAuthKind::Cli), and parse_for_kind rejects OIDC entries for the CLI kind:

GrokAuthKind::Cli => !is_oauth,

A grok login-produced entry (scope https://auth.x.ai::..., auth_mode: "oidc") is OAuth, so no entry is selected and the tray app returns AuthRequired without attempting the Grok network request. With RUST_LOG=debug, refresh cycles showed Codex and Claude activity but no Grok activity or grok.com connection.

Claude already has a provider-specific branch that preserves its OAuth path when cookies are off:

"off" if id == ProviderId::Claude && usage_source != SourceMode::Cli => {
    (SourceMode::OAuth, None)
}

Grok needs equivalent provider-aware routing for its OAuth-capable Auto and OAuth modes rather than being forced to CLI. For example, the off branch could route those modes to SourceMode::OAuth; the analogous manual-without-a-cookie path should also preserve Grok OAuth behavior.

Expected: with cookies off and a valid grok login, the tray app should use the auth.json OAuth path, as the CLI does.

Workaround: setting Grok's cookie source to auto restores the tray app on the next refresh because that branch preserves the configured usage source. However, it also permits browser-cookie extraction during refresh, which users who deliberately disabled cookies want to avoid.

Affected area

  • Tray panel
  • Settings UI
  • Config file / settings persistence
  • CLI
  • Provider-specific behavior
  • Installer / release packaging
  • Startup / background behavior
  • Other

Steps to reproduce

  1. Authenticate Grok via grok login (OIDC entry in ~/.grok/auth.json).
  2. In Settings → Providers → Grok, set usage source to Auto (or SuperGrok OAuth) and cookie source to off.
  3. Refresh (Ctrl+R) or restart the tray app.
  4. Observe that the Grok card shows "Authentication required", while codexbar-cli diagnose succeeds with "source": "grok-oauth".
  5. Set cookie source to auto; the tray app recovers on the next refresh.

Logs, screenshots, or recordings

codexbar-cli diagnose while the tray app showed "Authentication required":

"provider":"grok","source":"grok-oauth","source_mode":"auto",
"auth":{"configured":true},"usage":{"windows":[{"used_percent":9.0}]},"error":null

With RUST_LOG=debug, two tray-app refresh cycles showed debug lines and outbound connections for Codex (chatgpt.com) and Claude (api.anthropic.com) only—no Grok log lines and no grok.com connection.

App version

0.54.0 (winget: Finesssee.Win-CodexBar)

Windows version

Windows 11 Home 10.0.26200

Additional context

Issues #347 and #348 involved a different Claude credential-consent bug, but they are a useful recent example of provider-specific authentication behavior diverging between the backend and the desktop UI. This report is specifically about Grok source-mode routing in build_fetch_context.

Activity

  1. Finesssee commented on Aug 24, 2026

    @Finesssee
    Collaborator

    Hey, thanks for the issue. I will fix this ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions