Hi.
I am trying to display Google map reviews.
For that purpose I created the simple module.
But when I am trying to get access token, I get the error
Access is blocked: This app’s request is invalid.
The printscreen is attached.
Please, help me.
What I am doing wrong?
The code of module is below.
<?php
defined('_JEXEC') or die;
$path = getcwd() . '/libraries/googleapi/vendor/autoload.php';
require_once ($path);
use Joomla\CMS\Helper\ModuleHelper;
use Google\Client;
$client = new Client();
$client->setAuthConfig('client_secret_319227032410-jvvuj1kcf0b8c24grt3r47qnu1nnbhqu.apps.googleusercontent.com.json');
$client->setRedirectUri('http://' . $_SERVER['HTTP_HOST'] . '/gaapicallback.php');
$client->addScope(Google\Service\Drive::DRIVE_METADATA_READONLY);
//$client->addScope(Google\Service\DataPortability::DATAPORTABILITY_MAPS_REVIEWS);
$client->setAccessType('offline'); // offline access
$client->setIncludeGrantedScopes(true); // incremental auth
$auth_url = $client->createAuthUrl();
header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
echo '<pre>';
print_r($client);
echo '</pre>';
exit;
I am trying to display Google map reviews.
For that purpose I created the simple module.
But when I am trying to get access token, I get the error
Access is blocked: This app’s request is invalid.
The printscreen is attached.
Please, help me.
What I am doing wrong?
The code of module is below.
<?php
defined('_JEXEC') or die;
$path = getcwd() . '/libraries/googleapi/vendor/autoload.php';
require_once ($path);
use Joomla\CMS\Helper\ModuleHelper;
use Google\Client;
$client = new Client();
$client->setAuthConfig('client_secret_319227032410-jvvuj1kcf0b8c24grt3r47qnu1nnbhqu.apps.googleusercontent.com.json');
$client->setRedirectUri('http://' . $_SERVER['HTTP_HOST'] . '/gaapicallback.php');
$client->addScope(Google\Service\Drive::DRIVE_METADATA_READONLY);
//$client->addScope(Google\Service\DataPortability::DATAPORTABILITY_MAPS_REVIEWS);
$client->setAccessType('offline'); // offline access
$client->setIncludeGrantedScopes(true); // incremental auth
$auth_url = $client->createAuthUrl();
header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
echo '<pre>';
print_r($client);
echo '</pre>';
exit;
Statistics: Posted by tmisiunas — Mon Apr 08, 2024 7:55 pm