initial commit

This commit is contained in:
Jurgis Sakalauskas
2025-01-08 12:45:00 +02:00
commit 6df493fab3
86 changed files with 11890 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App\Services\Google;
use Google\Client;
class ApiAuthService
{
/**
* @throws \Google\Exception
*/
public function getAccessToken(): string
{
$client = new Client();
$serviceAccountKeyPath = env('GOOGLE_APPLICATION_CREDENTIALS');
$client->setAuthConfig($serviceAccountKeyPath);
$client->addScope('https://www.googleapis.com/auth/cloud-platform');
$client->fetchAccessTokenWithAssertion();
// todo - cache, refresh, etc
$accessToken = $client->getAccessToken();
return $accessToken['access_token'];
}
}