{"slug": "fixing-google-bigquery-auth-proxying", "title": "Fixing Google BigQuery Auth Proxying", "summary": "The article explains that when using Google BigQuery client libraries in C# applications behind a proxy, authentication and token refresh requests fail because they ignore proxy settings, even when data queries are correctly proxied. The solution is to set a proxied `GoogleCredential` (created using `CreateWithHttpClientFactory`) on the `GoogleCredential` property of `BigQueryClientBuilder`, rather than the `Credential` property, to ensure OAuth token requests also route through the proxy.", "body_md": "builder.Credential = credential;\n- Fails to route authentication traffic through the proxy.builder.GoogleCredential = credential;\n- Successfully routes OAuth token requests through the proxy.If your C# application runs behind a proxy, you have probably run into an annoying issue with the Google BigQuery client libraries: your BigQuery query calls route through the proxy perfectly by setting the HttpClientFactory\nproperty on the BigQueryClientBuilder\n, but the authentication and token refresh requests ignore the proxy entirely and attempt to hit the standard network, causing timeouts.\nTo resolve this, set a proxied GoogleCredential\nto the GoogleCredential\nproperty instead of the Credential\nproperty on the client builder.\nExample code:\nusing System.Net;\nusing Google.Apis.Auth.OAuth2;\nusing Google.Apis.Http;\nusing Google.Cloud.BigQuery.V2;\n// 1. Configure your proxy\nIWebProxy proxySettings = new WebProxy(\"http://your-proxy-host:8080\", bypassOnLocal: true)\n{\nCredentials = new NetworkCredential(\"username\", \"password\")\n};\n// 2. Wrap it inside Google's API HttpClientFactory\nHttpClientFactory proxyClientFactory = HttpClientFactory.ForProxy(proxySettings);\n// 3. Load credentials and create a new credential using the proxied http client factory\nGoogleCredential credential = await GoogleCredential.FromFileAsync(\"path/to/service-account.json\");\ncredential = credential.CreateWithHttpClientFactory(proxyClientFactory);\n// 4. Construct the client\nBigQueryClient bigQueryClient = new BigQueryClientBuilder\n{\nProjectId = \"your-google-cloud-project-id\",\nHttpClientFactory = proxyClientFactory, // Proxies BigQuery data calls\nGoogleCredential = credential // CRITICAL: Proxies Auth/token calls\n}.Build();", "url": "https://wpnews.pro/news/fixing-google-bigquery-auth-proxying", "canonical_source": "https://dev.to/snargledorf/fixing-google-bigquery-auth-proxying-2hb7", "published_at": "2026-05-22 20:15:08+00:00", "updated_at": "2026-05-22 20:32:11.068413+00:00", "lang": "en", "topics": ["cloud-computing", "developer-tools", "data"], "entities": ["Google BigQuery", "Google", "BigQueryClientBuilder", "GoogleCredential", "HttpClientFactory", "WebProxy", "NetworkCredential"], "alternates": {"html": "https://wpnews.pro/news/fixing-google-bigquery-auth-proxying", "markdown": "https://wpnews.pro/news/fixing-google-bigquery-auth-proxying.md", "text": "https://wpnews.pro/news/fixing-google-bigquery-auth-proxying.txt", "jsonld": "https://wpnews.pro/news/fixing-google-bigquery-auth-proxying.jsonld"}}