Try to search your question here, if you can't find : Ask Any Question Now ?

How to use JSON key data to request a access token in php?

HomeCategory: stackoverflowHow to use JSON key data to request a access token in php?
Avatarbhawya asked 4 weeks ago

I am trying to use the google analyitics embed library with the php api

There's an example of it on the library page itself, but the example is for python, I looked for similar functions in the PHP library and not found it.

In short I need to have the access token using the JSON file provided using PHP.

Who can help me I am very grateful, I have been testing the various functions and libraries for 3 days.

    function initializeAnalytics()
        // Creates and returns the Analytics Reporting service object.

        // Use the developers console and download your service account
        // credentials in JSON format. Place them in this directory or
        // change the key file location if necessary.
        $KEY_FILE_LOCATION = __DIR__ . '/igneous-future-252421-929cebfbbc73.json';

        // Create and configure a new client object.
        $client = new Google_Client();
        $client->setApplicationName("Hello Analytics Reporting");
        $analytics = new Google_Service_Analytics($client);

        return $analytics;

This function in php is working, I need to implement it to receive the access token. I tried using some methods like getAuth, getAccessToken, but to no avail.

1 Answers
Best Answer
AvatarMikhail answered 4 weeks ago
Your Answer

17 + 5 =

Popular Tags

WP Facebook Auto Publish Powered By :