Skip to content

Commit

Permalink
fix google adsense
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Sep 12, 2024
1 parent 50029ba commit 4839c87
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/Config/GoogleAdsense.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,11 @@
*/

'RedirectUri' => 'http://localhost:8000/googleadsense/callback',

/**
*
* Google Adsense Auth Config File
*
*/
'auth_config_file' => storage_path('app/client_secret_33839582772-7bqi2gto92jms75ujbhvfo22je2haold.apps.googleusercontent.com.json'),
];
8 changes: 5 additions & 3 deletions src/Http/Controllers/Api/GoogleAdsenseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ public function __construct()
//$this->middleware('permission:report-google-adsense', ['only' => ['googleAdsense']]);

$this->client = new Google_Client();
$this->client->addScope('https://www.googleapis.com/auth/adsense.readonly');
$this->client->addScope('https://www.googleapis.com/auth/adsense');
// $this->client->addScope('https://www.googleapis.com/auth/adsense.readonly');
// $this->client->addScope('https://www.googleapis.com/auth/adsense');
$this->client->addScope(config('GoogleAdsense.Scopes'));
$this->client->setAccessType('offline');
$this->client->setApprovalPrompt('force');
$this->client->setAuthConfig(storage_path('app/client_secret_33839582772-7bqi2gto92jms75ujbhvfo22je2haold.apps.googleusercontent.com.json'));
//$this->client->setAuthConfig(storage_path('app/client_secret_33839582772-7bqi2gto92jms75ujbhvfo22je2haold.apps.googleusercontent.com.json'));
$this->client->setAuthConfig(config('GoogleAdsense.auth_config_file'));

$this->client->setRedirectUri(route('googleadsense.web.googleadsense.callback'));

Expand Down
7 changes: 4 additions & 3 deletions src/Http/Controllers/Web/GoogleAdsenseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ class GoogleAdsenseController extends Controller
public function __construct()
{
$this->client = new Google_Client();
$this->client->addScope('https://www.googleapis.com/auth/adsense.readonly');
$this->client->addScope('https://www.googleapis.com/auth/adsense');
// $this->client->addScope('https://www.googleapis.com/auth/adsense.readonly');
// $this->client->addScope('https://www.googleapis.com/auth/adsense');
$this->client->addScope(config('GoogleAdsense.Scopes'));
$this->client->setAccessType('offline');
$this->client->setApprovalPrompt('force');
$this->client->setAuthConfig(storage_path('app/client_secret_33839582772-7bqi2gto92jms75ujbhvfo22je2haold.apps.googleusercontent.com.json'));
$this->client->setAuthConfig(config('GoogleAdsense.auth_config_file'));
}

public function index()
Expand Down

0 comments on commit 4839c87

Please sign in to comment.