Navigating PrestaShop Multistore OAuth: Resolving ps_accounts Redirect URI Errors

PrestaShop Multistore OAuth: Unpacking the ps_accounts Redirect URI Conundrum

In the intricate world of PrestaShop multistore installations, even seemingly minor configuration discrepancies can lead to significant operational hurdles. A recent forum discussion sheds light on a specific challenge faced by merchants using PrestaShop 9.1.3: the 'invalid_request' OAuth error related to the redirect_uri parameter within the ps_accounts module, particularly when one store in a multistore setup fails to connect while others operate flawlessly.

The original poster, dato_1234, detailed a scenario where a PrestaShop 9.1.3 multistore environment housed two shops: 'Frazycars' working correctly with PrestaShop Account, and 'FoxLabStudios' failing to complete login. Despite 'FoxLabStudios' being verified, having its own Cloud Shop ID and domain (https://www.foxlabstudios.pl/), and various troubleshooting steps (module updates, clearing cache, direct Back Office access, HTTPS verification), the OAuth process consistently returned: "Error: invalid_request. The 'redirect_uri' parameter does not match any of the OAuth 2.0 Client's pre-registered redirect urls." This indicated a mismatch in how the module was communicating with the OAuth provider, specifically regarding the callback URL.

The Expert Diagnosis: Domain Mismatch in Multistore Settings

An insightful reply from Knowband Plugins quickly pinpointed the likely root cause. The ps_accounts module doesn't rely on a manually entered redirect URI; instead, it dynamically constructs this URI using each shop's domain settings via PrestaShop's internal Link::getAdminLink(..., $shopId) function. This crucial detail highlighted that the error wasn't due to a 'broken client' but rather a 'domain mismatch' within the PrestaShop configuration itself.

The expert advised checking the 'Advanced Parameters > Multistore' section for the problematic shop ('FoxLabStudios'). Specifically, both the 'domain' and 'SSL domain' entries in the shop's URL row needed to be precisely www.foxlabstudios.pl. Common culprits for this mismatch include a missing 'www' prefix or a stale SSL domain entry. The recommended fix involved switching the multistore context to the affected shop, unlinking the ps_accounts module, and then relinking it to force a regeneration of the correct redirect URI based on the now-corrected domain settings.

Partial Resolution and Community Call for Detail

While Knowband Plugins provided a clear diagnostic path and a highly actionable solution, the original poster, dato_1234, later confirmed that the issue was resolved by "cloud fixed it. Reconnecting something in database using SQL query." This vague resolution, while effective for the poster, left the community without the specific SQL commands or database tables involved. Knowband Plugins rightly emphasized the importance of sharing these details, as this particular OAuth error in multistore setups is a recurring challenge for many PrestaShop users.

This thread underscores the critical nature of accurate domain configuration in PrestaShop multistore environments, especially when integrating with modules like ps_accounts that rely on dynamically generated URLs for OAuth authentication. While a precise database fix remains elusive from this particular discussion, the diagnostic steps provided offer a strong starting point for anyone encountering similar redirect_uri errors.

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools