[ANALYTICS-420] Investigate why request had invalid authentication credentials in GA4 Created: 05/Apr/23 Updated: 25/May/23 Resolved: 14/Apr/23 |
|
| Status: | Closed |
| Project: | Analytics |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.2.3 |
| Type: | Spike | Priority: | Neutral |
| Reporter: | Thuy To | Assignee: | Alberto Soto |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | 5.5h | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||
| Issue Links: |
|
||||||||||||
| Template: |
|
||||||||||||
| Date of First Response: | |||||||||||||
| Epic Link: | Google Analytics 4 | ||||||||||||
| Story Points: | 3 | ||||||||||||
| Team: | |||||||||||||
| Work Started: | |||||||||||||
| Description |
|
+ Sample yaml configuration: class: info.magnolia.analytics.google.datasource.GoogleDataSupplier credentials: applicationName: Magnolia Analytics serviceAccountJsonPath: /google-analytics/dataSuppliers/authorxga4-key.json parameters: propertyId: 354424382 startDate: 7DaysAgo endDate: today dimensionName: date metricExpression: sessions + Document refer: https://github.com/googleapis/java-analytics-data
+ Problem: When running to get the GA4 report on Analytics module of Magnolia, it throws this error. io.grpc.StatusRuntimeException: UNAUTHENTICATED: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
|
| Comments |
| Comment by Thuy To [ 14/Apr/23 ] |
|
This problem io.grpc.StatusRuntimeException: UNAUTHENTICATED: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. is fixed when using info.magnolia.resourceloader.Resource with .openStream() method. Solution: GoogleCredentials credentials = GoogleCredentials.fromStream(serviceAccountJsonResource.openStream()) |