René's URL Explorer Experiment


Title: Credentials subject and Domain-wide delegation access issue for BetaAnalyticsDataClient · Issue #341 · googleapis/python-analytics-data · GitHub

Open Graph Title: Credentials subject and Domain-wide delegation access issue for BetaAnalyticsDataClient · Issue #341 · googleapis/python-analytics-data

X Title: Credentials subject and Domain-wide delegation access issue for BetaAnalyticsDataClient · Issue #341 · googleapis/python-analytics-data

Description: Environment details OS type and version: Linux-5.4.0-1094-aws-x86_64-with-glibc2.17 Python version: Python 3.8.12 pip version: pip 21.2.4 google-analytics-data version: Version: 0.16.1 Steps to reproduce Using quickstart.py code supplied...

Open Graph Description: Environment details OS type and version: Linux-5.4.0-1094-aws-x86_64-with-glibc2.17 Python version: Python 3.8.12 pip version: pip 21.2.4 google-analytics-data version: Version: 0.16.1 Steps to rep...

X Description: Environment details OS type and version: Linux-5.4.0-1094-aws-x86_64-with-glibc2.17 Python version: Python 3.8.12 pip version: pip 21.2.4 google-analytics-data version: Version: 0.16.1 Steps to rep...

Opengraph URL: https://github.com/googleapis/python-analytics-data/issues/341

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Credentials subject and Domain-wide delegation access issue for BetaAnalyticsDataClient","articleBody":"#### Environment details\r\n\r\n  - OS type and version: Linux-5.4.0-1094-aws-x86_64-with-glibc2.17\r\n  - Python version: Python 3.8.12\r\n  - pip version: pip 21.2.4\r\n  - `google-analytics-data` version: Version: 0.16.1\r\n\r\n#### Steps to reproduce\r\n\r\n  1. Using quickstart.py code supplied in this repo;\r\n  2. Using the domain-wide delegation scopes below in Workspace Admin;\r\n  3. Oauth subject email has Administrator access to property;\r\n  4. API access granted for GCP project;\r\n  5. Using service account that currently operates normally for GA and GSC using subject delegation.\r\n\r\n#### Domain-wide Delegation Scopes\r\n```\r\nhttps://www.googleapis.com/auth/webmasters.readonly\r\nhttps://www.googleapis.com/auth/analytics.readonly\r\nhttps://www.googleapis.com/auth/analytics\r\nopenid\r\n```\r\n\r\n#### Code example\r\n\r\n```python\r\nfrom google.analytics.data_v1beta import BetaAnalyticsDataClient\r\nfrom google.oauth2 import service_account\r\nfrom google.analytics.data_v1beta.types import (\r\n    DateRange,\r\n    Dimension,\r\n    Metric,\r\n    RunReportRequest,\r\n)\r\n\r\n\r\nSERVICE_ACCOUNT_CREDENTIALS = \"credentials/path-to-service-account-json.json\"\r\nSERVICE_ACCOUNT_SUBJECT = \"user@domain.com\"\r\n\r\ndef sample_run_report(property_id=\"\u003cproperty-id>\"):\r\n    \"\"\"Runs a simple report on a Google Analytics 4 property.\"\"\"\r\n    # TODO(developer): Uncomment this variable and replace with your\r\n    #  Google Analytics 4 property ID before running the sample.\r\n    # property_id = \"YOUR-GA4-PROPERTY-ID\"\r\n\r\n    # [START analyticsdata_json_credentials_initialize]\r\n    # TODO(developer): Uncomment this variable and replace with a valid path to\r\n    #  the credentials.json file for your service account downloaded from the\r\n    #  Cloud Console.\r\n    # credentials_json_path = \"/path/to/credentials.json\"\r\n\r\n    # Explicitly use service account credentials by specifying\r\n    # the private key file.\r\n    credentials = service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_CREDENTIALS, subject=SERVICE_ACCOUNT_SUBJECT)\r\n    client = BetaAnalyticsDataClient(credentials=credentials)\r\n    \r\n    # [END analyticsdata_json_credentials_initialize]\r\n\r\n    # [START analyticsdata_json_credentials_run_report]\r\n    request = RunReportRequest(\r\n        property=f\"properties/{property_id}\",\r\n        dimensions=[Dimension(name=\"city\")],\r\n        metrics=[Metric(name=\"activeUsers\")],\r\n        date_ranges=[DateRange(start_date=\"2020-03-31\", end_date=\"today\")],\r\n    )\r\n    response = client.run_report(request)\r\n    # [END analyticsdata_json_credentials_run_report]\r\n\r\n    print(\"Report result:\")\r\n    for row in response.rows:\r\n        print(row.dimension_values[0].value, row.metric_values[0].value)\r\n\r\n\r\nsample_run_report(property_id=\"XXXXXXXXXX\")\r\n\r\n```\r\n\r\n#### Stack trace\r\n```\r\n_InactiveRpcError                         Traceback (most recent call last)\r\n/opt/tljh/user/lib/python3.8/site-packages/google/api_core/grpc_helpers.py in error_remapped_callable(*args, **kwargs)\r\n     64         try:\r\n---> 65             return callable_(*args, **kwargs)\r\n     66         except grpc.RpcError as exc:\r\n\r\n/opt/tljh/user/lib/python3.8/site-packages/grpc/_channel.py in __call__(self, request, timeout, metadata, credentials, wait_for_ready, compression)\r\n    945                                       wait_for_ready, compression)\r\n--> 946         return _end_unary_response_blocking(state, call, False, None)\r\n    947 \r\n\r\n/opt/tljh/user/lib/python3.8/site-packages/grpc/_channel.py in _end_unary_response_blocking(state, call, with_call, deadline)\r\n    848     else:\r\n--> 849         raise _InactiveRpcError(state)\r\n    850 \r\n\r\n_InactiveRpcError: \u003c_InactiveRpcError of RPC that terminated with:\r\n\tstatus = StatusCode.PERMISSION_DENIED\r\n\tdetails = \"User does not have sufficient permissions for this property. To learn more about Property ID, see https://developers.google.com/analytics/devguides/reporting/data/v1/property-id.\"\r\n\tdebug_error_string = \"UNKNOWN:Error received from peer ipv4:172.253.63.95:443 {created_time:\"2023-02-09T13:29:52.563206159+00:00\", grpc_status:7, grpc_message:\"User does not have sufficient permissions for this property. To learn more about Property ID, see https://developers.google.com/analytics/devguides/reporting/data/v1/property-id.\"}\"\r\n>\r\n\r\nThe above exception was the direct cause of the following exception:\r\n\r\nPermissionDenied                          Traceback (most recent call last)\r\n/tmp/ipykernel_30595/3858193892.py in \u003cmodule>\r\n     46 \r\n     47 \r\n---> 48 sample_run_report(property_id=\"281603923\")\r\n\r\n/tmp/ipykernel_30595/3858193892.py in sample_run_report(property_id)\r\n     38         date_ranges=[DateRange(start_date=\"2020-03-31\", end_date=\"today\")],\r\n     39     )\r\n---> 40     response = client.run_report(request)\r\n     41     # [END analyticsdata_json_credentials_run_report]\r\n     42 \r\n\r\n/opt/tljh/user/lib/python3.8/site-packages/google/analytics/data_v1beta/services/beta_analytics_data/client.py in run_report(self, request, retry, timeout, metadata)\r\n    491 \r\n    492         # Send the request.\r\n--> 493         response = rpc(\r\n    494             request,\r\n    495             retry=retry,\r\n\r\n/opt/tljh/user/lib/python3.8/site-packages/google/api_core/gapic_v1/method.py in __call__(self, timeout, retry, *args, **kwargs)\r\n    111             kwargs[\"metadata\"] = metadata\r\n    112 \r\n--> 113         return wrapped_func(*args, **kwargs)\r\n    114 \r\n    115 \r\n\r\n/opt/tljh/user/lib/python3.8/site-packages/google/api_core/grpc_helpers.py in error_remapped_callable(*args, **kwargs)\r\n     65             return callable_(*args, **kwargs)\r\n     66         except grpc.RpcError as exc:\r\n---> 67             raise exceptions.from_grpc_error(exc) from exc\r\n     68 \r\n     69     return error_remapped_callable\r\n\r\nPermissionDenied: 403 User does not have sufficient permissions for this property. To learn more about Property ID, see https://developers.google.com/analytics/devguides/reporting/data/v1/property-id.\r\n```\r\n\r\nI am unable to provide delegated access to properties using the same subject delegation that works in the GA3 API.  I have searched to see if there is another scope for delegation in our Workspace account relative to this beta version.  It is my understanding that `https://www.googleapis.com/auth/analytics.readonly` should provide this.  We use a centralized Google Workspace email as a user on multiple GA4 properties to make reporting more efficient.  Currently, we can't figure out how to unblock these permission denied errors using subject delgation, using code provided as example.","author":{"url":"https://github.com/jroakes","@type":"Person","name":"jroakes"},"datePublished":"2023-02-09T13:51:16Z","url":"https://github.com/googleapis/python-analytics-data/issues/341"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:498a440d-1488-a495-e65f-21116fd7adeb
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id98B4:275045:186A95:1E6320:6B09EB48
html-safe-noncec5d6a32fb16f99e86d8db87c183925e64f679966a9303a6a506db78cc2bb387b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OEI0OjI3NTA0NToxODZBOTU6MUU2MzIwOjZCMDlFQjQ4IiwidmlzaXRvcl9pZCI6IjY2MDk5NjkyNzc1MjM1ODU4NjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac2535c30d0858681ee5e45465aaa65671f03450e407086ed9e5d0a4423453264e
hovercard-subject-tagissue:1577929354
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/python-analytics-data/341/issue_layout
twitter:imagehttps://opengraph.githubassets.com/63b524eaa4426af2d669e197618f4df00bf4eb8d21f8c7c6b0373f9c9c6356c7/googleapis/python-analytics-data/issues/341
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/63b524eaa4426af2d669e197618f4df00bf4eb8d21f8c7c6b0373f9c9c6356c7/googleapis/python-analytics-data/issues/341
og:image:altEnvironment details OS type and version: Linux-5.4.0-1094-aws-x86_64-with-glibc2.17 Python version: Python 3.8.12 pip version: pip 21.2.4 google-analytics-data version: Version: 0.16.1 Steps to rep...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejroakes
hostnamegithub.com
expected-hostnamegithub.com
None29e6866c4c5b6697a062df08d37fa80bbfb75810ca4280c0d277f04956012d39
turbo-cache-controlno-preview
go-importgithub.com/googleapis/python-analytics-data git https://github.com/googleapis/python-analytics-data.git
octolytics-dimension-user_id16785467
octolytics-dimension-user_logingoogleapis
octolytics-dimension-repository_id295544284
octolytics-dimension-repository_nwogoogleapis/python-analytics-data
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id295544284
octolytics-dimension-repository_network_root_nwogoogleapis/python-analytics-data
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee72aac8801621433bb0313888fbbe243f5998abc
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/googleapis/python-analytics-data/issues/341#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fpython-analytics-data%2Fissues%2F341
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fpython-analytics-data%2Fissues%2F341
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=googleapis%2Fpython-analytics-data
Reloadhttps://github.com/googleapis/python-analytics-data/issues/341
Reloadhttps://github.com/googleapis/python-analytics-data/issues/341
Reloadhttps://github.com/googleapis/python-analytics-data/issues/341
googleapishttps://github.com/googleapis
python-analytics-datahttps://github.com/googleapis/python-analytics-data
Codehttps://github.com/googleapis/python-analytics-data
Issueshttps://github.com/googleapis/python-analytics-data/issues
Pull requestshttps://github.com/googleapis/python-analytics-data/pulls
Actionshttps://github.com/googleapis/python-analytics-data/actions
Projectshttps://github.com/googleapis/python-analytics-data/projects
Security and qualityhttps://github.com/googleapis/python-analytics-data/security
Insightshttps://github.com/googleapis/python-analytics-data/insights
https://github.com/googleapis/python-analytics-data
Credentials subject and Domain-wide delegation access issue for BetaAnalyticsDataClienthttps://github.com/googleapis/python-analytics-data/issues/341#top
api: analyticsdatahttps://github.com/googleapis/python-analytics-data/issues?q=state%3Aopen%20label%3A%22api%3A%20analyticsdata%22
type: questionhttps://github.com/googleapis/python-analytics-data/issues?q=state%3Aopen%20label%3A%22type%3A%20question%22
https://github.com/jroakes
jroakeshttps://github.com/jroakes
on Feb 9, 2023https://github.com/googleapis/python-analytics-data/issues/341#issue-1577929354
product-auto-labelhttps://github.com/apps/product-auto-label
api: analyticsdatahttps://github.com/googleapis/python-analytics-data/issues?q=state%3Aopen%20label%3A%22api%3A%20analyticsdata%22
on Feb 9, 2023https://github.com/googleapis/python-analytics-data/issues/341#event-8479631689
https://github.com/jroakes
jroakeshttps://github.com/jroakes
on Feb 13, 2023https://github.com/googleapis/python-analytics-data/issues/341#issuecomment-1428405639
https://github.com/parthea
partheahttps://github.com/parthea
on Feb 15, 2023https://github.com/googleapis/python-analytics-data/issues/341#issuecomment-1431759661
partheahttps://github.com/parthea
completedhttps://github.com/googleapis/python-analytics-data/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Feb 15, 2023https://github.com/googleapis/python-analytics-data/issues/341#event-8528648597
partheahttps://github.com/parthea
type: questionhttps://github.com/googleapis/python-analytics-data/issues?q=state%3Aopen%20label%3A%22type%3A%20question%22
on Feb 15, 2023https://github.com/googleapis/python-analytics-data/issues/341#event-8528649969
https://github.com/joejoinerr
joejoinerrhttps://github.com/joejoinerr
on Feb 17, 2023https://github.com/googleapis/python-analytics-data/issues/341#issuecomment-1434530862
@partheahttps://github.com/parthea
python-analytics-data/setup.pyhttps://github.com/googleapis/python-analytics-data/blob/9f18c1f09b95e4351adad3674b4d67a39a63482e/setup.py#L39
9f18c1fhttps://github.com/googleapis/python-analytics-data/commit/9f18c1f09b95e4351adad3674b4d67a39a63482e
Sign up for freehttps://github.com/signup?return_to=https://github.com/googleapis/python-analytics-data/issues/341
Sign in to commenthttps://github.com/login?return_to=https://github.com/googleapis/python-analytics-data/issues/341
api: analyticsdatahttps://github.com/googleapis/python-analytics-data/issues?q=state%3Aopen%20label%3A%22api%3A%20analyticsdata%22
type: questionhttps://github.com/googleapis/python-analytics-data/issues?q=state%3Aopen%20label%3A%22type%3A%20question%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.