I cant seem to fined an updated tutorial for getting the .p12 file from the Google Developer Console.
$client = new Google_Client();
$client->setApplicationName("XXXXXXXX");
$client->setAssertionCredentials(
new \Google_Auth_AssertionCredentials(
'xxxxxxxxxx@developer.gserviceaccount.com',
array('https://www.googleapis.com/auth/analytics.readonly'),
file_get_contents(app_path()."\config\analytics\client_secret_xxxxxxxxxxxxx.apps.googleusercontent.com.json")
)
);
$client->setClientId('xxxxxx.apps.googleusercontent.com');
$client->setAccessType('offline_access');
$service = new Google_Service_Analytics($client);
Im getting this error
Unable to parse the p12 file. Is this a .p12 file? Is the password correct? OpenSSL error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
Im using the latest version of the api at repository. The file im trying to parce is the one downloaded in the developer console under: Apis & Auth -> credentials -> Download JSON. Right after creating a new Cliend Id. I cant fined were the .p12 file can be downloaded or if it still necessary.
You need to create a Service Account
not a Web Application
or Installed Application
. Once you've created such a client there's a button called "Generate new P12 key" that you can use to generate and download a .p12 file.