Are you facing difficulties trying to coordinate efforts between marketing and sales? The SuiteCRM & Mautic Integrator by eVolpe is the best solution that will help you solve this issue. TRY IT NOW FOR FREE!
#2704 - Authorisation fails - unknown error encountered when trying to obtain the access token
Hello,
Could somebody provide some guidance please to resolve the following authentication error?
I've completed the installation process and begun configuration and run into the following problem when trying to authenticate the Mautic <> SuiteCRM API according to the guide: https://store.suitecrm.com/docs/mautic-suitecrm-integrator/configuration-guide
Authorisation failed with the error message, 'There was an unknown error encountered when trying to obtain the access token.'
When establishing the API credentials the following syntax is required for the callback (which I've used)
As callback set up address with http:// and https:// separated by comma: http://CRM_instance_URL_address/mautic_api/get_token,https://CRM_instance_URL_address/mautic_api/get_token, for example http://example.com/crm/mautic_api/get_token,https://example.com/crm/mautic_api/get_token
I've replaced example.com/crm/ with my installation path which is a subdomain crm.mysite.ext (URL path has been rewritten to protect address) and entered that into the Mautic connector credentials.
However, when I check the SuiteCRM installation root there is no such folder /mautic_api/ despite having installed the plugin and set-up the Connector properly within SuiteCRM.
This should be a straightforward step.
Any feedback would be greatfully received.
4 years ago
Mautic v2.16.1 SuiteCRM Version 7.11.12 Sugar Version 6.5.25 (Build 344)
4 years ago
Hello Nic,
We will try to resolve your problem as soon as possible. Thank you for the information so far. I need additional information: - what version of PHP? - what version of our integrator?
Best regards, Maciej Jankiewicz eVolpe Support Team
4 years ago
Hello Maciej
I just realised that the path is being rewritten as follows, which makes sense: mautic_api/get_token index.php?entryPoint=MauticGetToken
what version of PHP? 7.3
what version of our integrator? eVolpe_Mautic_CRM_3.11.113 eVolpe_CRM_Mautic_3.11.234
4 years ago
Do you require any more information Maciej in order to assist?
4 years ago
Hi Nic,
I had a similar problem. Could you check your config.php file in the root folder of your SuiteCRM installation. If you are on an AWS server like mine the suitecrm installation defaults to the aws server url. ie. ec2-11-111-111-111 If you can update the site_url value to your domain name it might work.
Good luck. This solution worked for me after two days of trying to connect.
Kind regards, Alexander Robinson Managing Director of Anamise Pty Ltd
4 years ago
Hi Alexander, Thank you for your response. I checked the config.php and it's using the domain. I have successfully authenticated using the standard Mautic integration plugin that comes with SuiteCRM. However, I am unable to authenticate using the eVolpe plugin. Kind Regards, Nic W
4 years ago
I just did a test re-auth with the standard Sugar/SuiteCRM integration plugin and it worked just fine so it suggests a problem with the SuiteCRM & Mautic Integrator somewhere.
4 years ago
Nic,
I forwarded the above information to our developers. We will try to get back quickly with the answer.
MJ
4 years ago
Ok, thankyou MJ
4 years ago
"However, when I check the SuiteCRM installation root there is no such folder /mautic_api/ despite having installed the plugin and set-up the Connector properly within SuiteCRM."
The lack of this folder in CRM is correct because the http (| s) address: // CRM_instance_URL_address / mautic_api / get_token is intercepted by the file /. htaccess which should be updated when saving the Administration -> Connectors -> Connectors Settings -> Mautic Tab.
Please check if this file under the RewriteBase line shows: RewriteRule ^mautic_api/get_token index.php?entryPoint=MauticGetToken [L,QSA]
In addition, if you use the address for your instance as: • http (s): //example.com/my-crm-instance - then in the .htaccess file the RewriteBase entry should look like this: RewriteBase / my-crm-instance
• http (s): //my-crm-instance.example.com - then in the .htaccess file the entry RewriteBase should look like this: RewriteBase /
4 years ago
Yes, I realised afterwards that the path was being rewritten in the htaccess file.
The rewrite rule is present and correct: RewriteRule ^mautic_api/get_token index.php?entryPoint=MauticGetToken [L,QSA]
Rewrite base also present and correct: RewriteBase /
What do you suggest next?
4 years ago
If I follow the redirect it gives me the following URL;
https://MYSUB.MYDOMAIN.MYEXT/index.php?entryPoint=MauticGetToken
Which takes me (when I'm logged in) to;
https://MYSUB.MYDOMAIN.MYEXT/index.php?module=Connectors&action=ConnectorSettings
I have enabled the Mautic connector and have a Token Expiration Date which seems to be the exact date and time of when the access token was generated. It would seem that the token is expiring immediately ??
4 years ago
I've also checked Mautic API settings;
Access token lifetime = 60 minutes Refresh token lifetime = 14 days API request limit = 0
4 years ago
This is perhaps due to the difference in time zones setted between Mautic and SuiteCRM instances. Try to increase Access token lifetime (i.e. 1440 minutes) and Refresh token lifetime (i.e. 100 days).
4 years ago
The standard SugarCRM plugin authenticated with Mautic without problem so I'm a little confused why this isn't working.
4 years ago
The instances are on the same server and I configured the locale setting to be the same (including suitecrm user).
I did adjust the token expiration and now I'm seeing a date in the future, however it's still not authorising ?
4 years ago
Nic,
I think we should organize videoconference. I will send you an email with meeting details.
MJ
4 years ago
Ok MJ. Nic
4 years ago
I've now solved the issue.
On checking the CRM logs I found the following error when trying to authenticate.
2020-04-21 13:34:07.390579 [INFO] [2171] [2a00:b0e0:6:5::36:59690] File not found [/home/USER/crm.MYDOMAIN.co.uk/404.shtml] 2020-04-21 13:34:07.390561 [INFO] [2171] [2a00:b0e0:6:5::36:59690] File not found [/home/USER/crm.MYDOMAIN.co.uk/service/v4_1_mautic/rest.php] 2020-04-21 13:34:07.390452 [ERROR] [2171] [HTAccess] Failed to open [/home/USER/crm.MYDOMAIN.co.uk/service/v4_1_mautic/.htaccess]: Permission denied
I checked the file permissions for the v4_1_mautic folder and found they were incorrect. Once I updated them ...... everything is now working.