Title: Invalid JWT Token when using Service Account JSON · Issue #3100 · googleapis/google-cloud-python · GitHub
Open Graph Title: Invalid JWT Token when using Service Account JSON · Issue #3100 · googleapis/google-cloud-python
X Title: Invalid JWT Token when using Service Account JSON · Issue #3100 · googleapis/google-cloud-python
Description: OS type and version macOS Sierra running a Debian Jessie Docker Container Python version and virtual environment information python --version CPython 3.5.0, no virtual environment google-cloud-python version pip show google-cloud, pip sh...
Open Graph Description: OS type and version macOS Sierra running a Debian Jessie Docker Container Python version and virtual environment information python --version CPython 3.5.0, no virtual environment google-cloud-pyth...
X Description: OS type and version macOS Sierra running a Debian Jessie Docker Container Python version and virtual environment information python --version CPython 3.5.0, no virtual environment google-cloud-pyth...
Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/3100
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Invalid JWT Token when using Service Account JSON","articleBody":"1. OS type and version\r\n\r\nmacOS Sierra running a Debian Jessie Docker Container\r\n\r\n2. Python version and virtual environment information `python --version`\r\n\r\nCPython 3.5.0, no virtual environment\r\n\r\n3. google-cloud-python version `pip show google-cloud`, `pip show google-\u003cservice\u003e` or `pip freeze`\r\n\r\ngoogle-cloud-bigquery==0.23.0\r\n\r\n4. Stacktrace if available\r\n\r\n```\r\nTraceback (most recent call last):\r\n File \"/usr/local/lib/python3.5/code.py\", line 91, in runcode\r\n exec(code, self.locals)\r\n File \"\u003cconsole\u003e\", line 1, in \u003cmodule\u003e\r\n File \"/usr/local/lib/python3.5/site-packages/celery/local.py\", line 191, in __call__\r\n return self._get_current_object()(*a, **kw)\r\n File \"/app/warehouse/celery.py\", line 53, in __call__\r\n return super().__call__(pyramid_env[\"request\"], *args, **kwargs)\r\n File \"/usr/local/lib/python3.5/site-packages/celery/app/task.py\", line 379, in __call__\r\n return self.run(*args, **kwargs)\r\n File \"/app/warehouse/packaging/tasks.py\", line 58, in compute_trending\r\n query.run()\r\n File \"/usr/local/lib/python3.5/site-packages/google/cloud/bigquery/query.py\", line 364, in run\r\n method='POST', path=path, data=self._build_resource())\r\n File \"/usr/local/lib/python3.5/site-packages/google/cloud/_http.py\", line 299, in api_request\r\n headers=headers, target_object=_target_object)\r\n File \"/usr/local/lib/python3.5/site-packages/google/cloud/_http.py\", line 193, in _make_request\r\n return self._do_request(method, url, headers, data, target_object)\r\n File \"/usr/local/lib/python3.5/site-packages/google/cloud/_http.py\", line 223, in _do_request\r\n body=data)\r\n File \"/usr/local/lib/python3.5/site-packages/google_auth_httplib2.py\", line 187, in request\r\n self._request, method, uri, request_headers)\r\n File \"/usr/local/lib/python3.5/site-packages/google/auth/credentials.py\", line 116, in before_request\r\n self.refresh(request)\r\n File \"/usr/local/lib/python3.5/site-packages/google/oauth2/service_account.py\", line 318, in refresh\r\n request, self._token_uri, assertion)\r\n File \"/usr/local/lib/python3.5/site-packages/google/oauth2/_client.py\", line 143, in jwt_grant\r\n response_data = _token_endpoint_request(request, token_uri, body)\r\n File \"/usr/local/lib/python3.5/site-packages/google/oauth2/_client.py\", line 109, in _token_endpoint_request\r\n _handle_error_response(response_body)\r\n File \"/usr/local/lib/python3.5/site-packages/google/oauth2/_client.py\", line 59, in _handle_error_response\r\n error_details, response_body)\r\ngoogle.auth.exceptions.RefreshError: ('invalid_grant: Invalid JWT Signature.', '{\\n \"error\" : \"invalid_grant\",\\n \"error_description\" : \"Invalid JWT Signature.\"\\n}')\r\n```\r\n\r\n5. Steps to reproduce\r\n\r\nTry to query anything in BigQuery using a service account with \"Viewer\" permissions and ``GOOGLE_APPLICATION_CREDENTIALS`` pointed to a JSON file downloaded when creating the service account.\r\n\r\n6. Code example\r\n\r\n```python\r\nbq = bigquery.Client()\r\nquery = bq.run_sync_query(\r\n \"\"\" SELECT project,\r\n IF(\r\n STDDEV(downloads) \u003e 0,\r\n (todays_downloads - AVG(downloads))/STDDEV(downloads),\r\n NULL\r\n ) as zscore\r\n FROM (\r\n SELECT project,\r\n date,\r\n downloads,\r\n FIRST_VALUE(downloads) OVER (\r\n PARTITION BY project\r\n ORDER BY DATE DESC\r\n ROWS BETWEEN UNBOUNDED PRECEDING\r\n AND UNBOUNDED FOLLOWING\r\n ) as todays_downloads\r\n FROM (\r\n SELECT file.project as project,\r\n DATE(timestamp) AS date,\r\n COUNT(*) as downloads\r\n FROM `the-psf.pypi.downloads*`\r\n WHERE _TABLE_SUFFIX BETWEEN\r\n FORMAT_DATE(\r\n \"%Y%m%d\",\r\n DATE_ADD(CURRENT_DATE(), INTERVAL -31 day))\r\n AND\r\n FORMAT_DATE(\r\n \"%Y%m%d\",\r\n DATE_ADD(CURRENT_DATE(), INTERVAL -1 day))\r\n GROUP BY file.project, date\r\n )\r\n )\r\n GROUP BY project, todays_downloads\r\n HAVING SUM(downloads) \u003e= 5000\r\n ORDER BY zscore DESC\r\n \"\"\"\r\n )\r\nquery.use_legacy_sql = False\r\nquery.run()\r\n```\r\n","author":{"url":"https://github.com/dstufft","@type":"Person","name":"dstufft"},"datePublished":"2017-03-06T03:23:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":28},"url":"https://github.com/3100/google-cloud-python/issues/3100"}
| 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:12c9c87d-971b-bf97-af93-4458b5a23b6e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8A9A:951F5:253E645:35E108D:6A4D1920 |
| html-safe-nonce | a17b0cf3106da5ec7ed4004a3165dd2fc1f5c17a3e7ebbba5bf16d108b94aef4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTlBOjk1MUY1OjI1M0U2NDU6MzVFMTA4RDo2QTREMTkyMCIsInZpc2l0b3JfaWQiOiI4MjYxMTYwNTI1MjIxNDAyOTEyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8e5ab7a0c85e6ac4abfea2be2bc28f1f7a94851c0c7f74aa62b6388aa59b914d |
| hovercard-subject-tag | issue:212015196 |
| 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/googleapis/google-cloud-python/3100/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6063a20d5692e6ee96b57287b3f4b26623a56151458b893a09066cc32d16feb5/googleapis/google-cloud-python/issues/3100 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6063a20d5692e6ee96b57287b3f4b26623a56151458b893a09066cc32d16feb5/googleapis/google-cloud-python/issues/3100 |
| og:image:alt | OS type and version macOS Sierra running a Debian Jessie Docker Container Python version and virtual environment information python --version CPython 3.5.0, no virtual environment google-cloud-pyth... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dstufft |
| hostname | github.com |
| expected-hostname | github.com |
| None | bcb4661e6fb4fe8b394c51ea02ccdb2236d40dc59afc75a3bbba50bf6517134c |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/google-cloud-python git https://github.com/googleapis/google-cloud-python.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 16316451 |
| octolytics-dimension-repository_nwo | googleapis/google-cloud-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 16316451 |
| octolytics-dimension-repository_network_root_nwo | googleapis/google-cloud-python |
| 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 | fb70bd3c4b2bec429781b65419e912c66e2d5581 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width