Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API not working properly #49

Open
hektisch opened this issue Jul 15, 2021 · 5 comments
Open

API not working properly #49

hektisch opened this issue Jul 15, 2021 · 5 comments

Comments

@hektisch
Copy link

hektisch commented Jul 15, 2021

Regarding to: https://docs.typo3.org/p/mautic/mautic-typo3/master/en-us/Installation/Index.html
I've generated the API Key with OAuth 1 and entered the information in TYPO3. Then I've clicked "Authorize with Mautic", then the Login appears, after this the Authorization but the I've got the first error and didn't get redirected to TYPO3 Backend.
At this point the connection seemed to work anyway, as I can see the Segments in the Backend.

Regarding to the Documentation there should be a green flashmessage that the connection to the Mautic API was successfull. But mine is red.

TYPO3 Installation:
TYPO3 10.4.17
mautic 4.0.1
marketing_automation 1.2.3
PHP Version 7.4.13

MAUTIC Installation:
matic v3.3.3
PHP Version 7.4.13

Mautic Installation is using a subdomain web.domain.com and the TYPO3 Website is using www.domain.com.
I've did some var_dumps to get an idea what happening. The only thing I found "strange" is one setting where I don't know where it comes from. $this->authorization returns the following (bold):

Bitmotion\Mautic\Mautic\OAuthprototypeobject
authorization => protectedMautic\Auth\OAuthprototypeobject
_access_token => protected'kkkkkkfffffff' (50 chars)
_access_token_secret => protected'kkkkkkkeeeeeee' (48 chars)
_access_token_updated => protectedFALSE
_access_token_url => protected'https://web.domain.com/oauth/v1/access_token' (47 chars)
_authorize_url => protected'https://web.domain.com/oauth/v1/authorize' (44 chars)
_callback => protected'https://www.domain.com/mautic/authorize' (42 chars)
_client_id => protected'aaaaabbbbbb' (49 chars)
_client_secret => protected'ccccccdddddd' (50 chars)
_do_not_redirect => protectedFALSE
_expires => protectedNULL
_redirect_type => protected'code' (4 chars)
_refresh_token => protectedNULL
_request_token_url => protected'https://web.domain.com/oauth/v1/request_token' (48 chars)
_scope => protectedarray(empty)
_token_type => protectedNULL
_debug => protectedFALSE
_httpResponseHeaders => protectedNULL
_httpResponseInfo => protectedNULL
_curlTimeout => protectedNULL
baseUrl => protected'https://web.domain.com' (25 chars)

This URL doesn't exist. Where does this callback come from. After I clicked "Authorize with Mautic" he was trying to redirect me to exactly the same URL that doesn't exist. The Error in both cases is:

array(2 items)
errors => array(1 item)
0 => array(2 items)
code => 500 (integer)
message => 'The response has unexpected status code (500). Response: {"errors":[{"messa
ge":"The site is currently offline due to encountering an error. If the prob
lem persists, please contact the system administrator. System administrators
, check server logs for errors.","code":500,"type":null}]}{"errors":[{"messa
ge":"Es sieht so aus, als ob wir auf einen Fehler gesto\u00dfen sind (Fehler
#500). Bitte melden Sie dies dem Administrator wenn es nochmal passiert. ",
"code":500,"type":null}]}' (481 chars)
error => array(2 items)
code => 500 (integer)
message => 'The response has unexpected status code (500). Response: {"errors":[{"messa
ge":"The site is currently offline due to encountering an error. If the prob
lem persists, please contact the system administrator. System administrators
, check server logs for errors.","code":500,"type":null}]}{"errors":[{"messa
ge":"Es sieht so aus, als ob wir auf einen Fehler gesto\u00dfen sind (Fehler
#500). Bitte melden Sie dies dem Administrator wenn es nochmal passiert. ",
"code":500,"type":null}]}' (481 chars)

Did I miss something or is this is some sort of bug. Any help is very appriciated. Thank's in advance.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@ekkeguembel
Copy link
Collaborator

Thanks @hektisch !
We are currently overhauling the API connection to support oauth2 and Mautic 4 - will look at this in the process.

@Starraider
Copy link

I have the exact same problem!

TYPO3 Installation:
TYPO3 10.4.20
mautic 4.0.1
marketing_automation 1.2.3
PHP Version 7.3.25

MAUTIC Installation:
matic v3.3.3
PHP Version 7.4.13

@hektisch
Copy link
Author

hektisch commented Mar 16, 2022

After Updating to the latest version many times and changing to OAuth2 it still didn't work. Backend always dropped an error (Flashmessage) after trying to authorize.

I figured out that $version = $contactsApi->getMauticVersion(); always returns NULL in mautic/Classes/Service/MauticAuthorizeService.php

       $version = $contactsApi->getMauticVersion();

        if ($version === null) {
            $this->addErrorMessage();

            return false;
        }

        if (version_compare($version, $this->minimumMauticVersion, '<')) {
            $this->showIncorrectVersionInformation($version);

            return false;
        }

Mautic is v4.1.0
TYPO3 is 10.4.20
mautic EXT is 4.1.0

Don't know if there is a connection to this: https://githubhot.com/repo/mautic/api-library/issues/233

@hektisch
Copy link
Author

After a few days of testing, I can confirm that the Plugin works fine, after removing the Code above.

hektisch added a commit to hektisch/mautic-typo3 that referenced this issue Mar 24, 2022
@Moongazer
Copy link
Contributor

@ekkeguembel Probably this issue can be closed, as I'm pretty sure it is/was related to mautic/api-library#233 which is fixed alread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants