solspace / craft-freeform

Freeform for Craft: The most reliable form builder that's ready for wherever your project takes you.
https://docs.solspace.com/craft/freeform/v5/
Other
47 stars 61 forks source link

Freeform 5 + Mailchimp (v3) Client error - 401 Unauthorized response #1170

Closed Ambareen15 closed 7 months ago

Ambareen15 commented 7 months ago

Describe the bug or issue you're experiencing I am trying to integrate mailchimp (v3) with freeform 5. This use to work via an API Key but as of freeform 5 you have to get a 'Client ID' and 'Client Secret' by registering an app within mailchimp. I've done this and followed all the steps in the setup guide yet I am getting a 401 Unauthorized when trying to authorize the integration.

Steps to reproduce

  1. ensure you have freeform 5 installed & attempt to integrate email marketing with the mailchimp (v3) service provider
  2. register an app in mailchimp
  3. copy across the Return URI from freeform to your app in mailchimp
  4. copy your Client ID and Client Secret from mailchimp and paste into freeform
  5. attempt to authorize your integration

Expected behavior I'd expect the integration to authorize successfully but instead I am getting this error: Client error: `GET https://us6.api.mailchimp.com/3.0/` resulted in a `401 Unauthorized` response: {"type":"https://mailchimp.com/developer/marketing/docs/errors/","title":"API Key Invalid","status":401,"detail":"Your r (truncated...)

Craft & Plugin Info (please complete the following information):

Additional context Screenshot 2024-03-27 at 15 20 40 Screenshot 2024-03-27 at 15 20 16

Log of error:

2024-03-27 15:12:55 [web.ERROR] [Solspace\Freeform\Library\Exceptions\Integrations\IntegrationException] {"error":"invalid_request","error_description":"Invalid redirect_uri or parameter missing"} {"trace":["#0 [internal function]: Solspace\\Freeform\\controllers\\integrations\\OAuthController->actionAuthorize()","#1 /home/forge/sitename/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()","#2 /home/forge/sitename/vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams()","#3 /home/forge/sitename/vendor/yiisoft/yii2/base/Module.php(552): yii\\base\\Controller->runAction()","#4 /home/forge/sitename/vendor/craftcms/cms/src/web/Application.php(307): yii\\base\\Module->runAction()","#5 /home/forge/sitename/vendor/yiisoft/yii2/web/Application.php(103): craft\\web\\Application->runAction()","#6 /home/forge/sitename/vendor/craftcms/cms/src/web/Application.php(292): yii\\web\\Application->handleRequest()","#7 /home/forge/sitename/vendor/yiisoft/yii2/base/Application.php(384): craft\\web\\Application->handleRequest()","#8 /home/forge/sitename/web/index.php(12): yii\\base\\Application->run()","#9 {main}"],"memory":4571752,"exception":"[object] (Solspace\\Freeform\\Library\\Exceptions\\Integrations\\IntegrationException(code: 0): {\"error\":\"invalid_request\",\"error_description\":\"Invalid redirect_uri or parameter missing\"} at /home/forge/sitename/vendor/solspace/craft-freeform/packages/plugin/src/controllers/integrations/OAuthController.php:62)"}
kjmartens commented 7 months ago

Sorry for the trouble @Ambareen15,

Can you please update to the latest version of Freeform (5.1.8)? We made a fix for this issue several versions back, and it appears you're using an old version. 🙂