Google reviews

For Joomla! 4.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
tmisiunas
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed May 25, 2011 8:37 pm

Google reviews

Post by tmisiunas » Mon Apr 08, 2024 7:55 pm

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.

Code: Select all

<?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;
You do not have the required permissions to view the files attached to this post.
Last edited by pe7er on Mon Apr 08, 2024 7:57 pm, edited 1 time in total.
Reason: added code block for readability

User avatar
AMurray
Joomla! Exemplar
Joomla! Exemplar
Posts: 9818
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: Google reviews

Post by AMurray » Mon Apr 08, 2024 10:09 pm

Pay attention to what the error is telling you: (its coming from Google, not Joomla).
error 400 redirect URI mismatch
From my research, you have to ensure you have put in the correct redirect URL (and possibly other details) in the Google API options fully and correctly.
Regards - A Murray
General Support Moderator


Post Reply

Return to “Joomla! 4.x Coding”