-
Problems with provisioning Google Analytics 4 account token in PHP
Hey all, I’m playing around with account provisioning functions in the Google Analytics 4 Admin API. All’s good until the point where I make the API call and get the provisioning ticket ID back. Here’s the script I whipped up to create the provisioning ticket:
$env_string = "GOOGLE_APPLICATION_CREDENTIALS=PATH_TO_MY_JSON_FILE"; // more lines of code... $tosBase = "https://analytics.google.com/analytics/web/?provisioningSignup=false#/termsofservice/"; // oops, extra slash, but will that be a big deal? $provisionURL = $tosBase . "/{$response->getAccountTicketId()}";
I snuck that ticket right into the ToS URL like this:
https://analytics.google.com/analytics/web/?provisioningSignup=false#/termsofservice//TICKET_ID
Showed that URL to my browser (incognito mode) and it threw a tantrum; came back with:
Error: Account token is missing.
So I thought “Alright, maybe the extra slash does matter!” Tried this:
https://analytics.google.com/analytics/web/?provisioningSignup=false#/termsofservice/TICKET_ID
And boom, another error:
Error: Access denied.
Clearly, neither of these are the result I’m after. Any of you have an idea where I might be tripping up? Just as a heads-up, I’m using the alpha code for the AnalyticsAdminService client. Thanks in advance!
Log in to reply.