Skip to content

Support HTTP proxy environment variables (http_proxy/https_proxy) #422

@femto

Description

@femto

Description

gws commands fail in environments requiring HTTP proxy (e.g., users in China who need proxy to access Google APIs).

Problem

The underlying yup-oauth2 and hyper HTTP clients don't respect standard proxy environment variables (http_proxy, https_proxy, ALL_PROXY).

Affected operations:

  1. gws auth login - OAuth token exchange fails
  2. All API calls - token refresh fails

Error message:

{
  "error": {
    "code": 401,
    "message": "Authentication failed: Failed to get token: Connection failure: Hyper error: client error (Connect): tcp connect error: Operation timed out (os error 60)",
    "reason": "authError"
  }
}

Environment

Current Workaround

  1. Manually exchange OAuth code using curl with proxy
  2. Save credentials to ~/.config/gws/credentials.json
  3. Use GOOGLE_WORKSPACE_CLI_TOKEN env var with manually refreshed access token

This is cumbersome as tokens expire every hour.

Suggested Fix

Option 1: Use reqwest with default features (includes proxy support):

# Cargo.toml - current
reqwest = { version = "0.12", features = ["json", "stream", "rustls-tls-native-roots"], default-features = false }

# Suggested - enable proxy support
reqwest = { version = "0.12", features = ["json", "stream", "rustls-tls-native-roots", "socks"] }

Option 2: Pass a custom hyper client with proxy support to yup-oauth2 using .with_hyper_client().

Option 3: Add explicit --proxy flag or GWS_PROXY / GWS_HTTPS_PROXY environment variable.

References

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