Skip to content

Commit e068391

Browse files
Merge pull request #587 from matomo-org/fallback-redirect-uri-check
Improved redirect URI check for MWP
2 parents 452f691 + ad2e43b commit e068391

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Changelog
22

3+
# 5.1.3 - 2025-05-28
4+
- Added fallback URI for valid redirect URI check to solve issues with some Matomo for WordPress install
5+
36
# 5.1.2 - 2025-03-17
47
- Started importing region data as the region dimension is now available in the API request
58

Google/Authorization.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Piwik\Container\StaticContainer;
1616
use Piwik\Option;
1717
use Piwik\Piwik;
18+
use Piwik\SettingsPiwik;
1819
use Piwik\Url;
1920

2021
class Authorization
@@ -136,8 +137,13 @@ protected function getUserInfoByAccessToken(\Matomo\Dependencies\GoogleAnalytics
136137
private function getValidUri($uris)
137138
{
138139
$validUri = Url::getCurrentUrlWithoutQueryString() . '?module=GoogleAnalyticsImporter&action=processAuthCode';
140+
$settingURL = SettingsPiwik::getPiwikUrl();
141+
if (stripos($settingURL, 'index.php') === false) {
142+
$settingURL .= 'index.php';
143+
}
144+
$validUriFallback = $settingURL . '?module=GoogleAnalyticsImporter&action=processAuthCode'; // Some MWP installs was not working as expected when using Url::getCurrentUrlWithoutQueryString()
139145
foreach ($uris as $uri) {
140-
if (stripos($uri, $validUri) !== \FALSE) {
146+
if (stripos($uri, $validUri) !== \false || stripos($uri, $validUriFallback) !== \false) {
141147
return $uri;
142148
}
143149
}

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "GoogleAnalyticsImporter",
33
"description": "Import reports from a Google Analytics account into Matomo.",
4-
"version": "5.1.2",
4+
"version": "5.1.3",
55
"theme": false,
66
"require": {
77
"matomo": ">=5.0.0-rc5,<6.0.0-b1"

0 commit comments

Comments
 (0)