Mautic Community Forums

Mautic VPS integration doesn't works with my sass system

Hello everyone!

I trying integrate mautic with my sass system (for send contacts, tags, etc).

I installed mautic in VPS.

My system is built in PHP, so i use this mautic repo https://github.com/mautic/api-library

But the follow code doesn’t works:

Code:
//defines define('MYBASEURL', 'http://url-to-mautic-instance'); define('MYCLIENT_KEY', 'SOME_OAUTH2_KEY'); define('MYCLIENT_SECRET', 'SOME_OAUTH2_SECRET');

// Initiate the auth object
$auth = ApiAuth::initiate(array(
‘baseUrl’ => MYBASEURL,
‘version’ => ‘OAuth2’,
‘clientKey’ => MYCLIENT_KEY,
‘clientSecret’ => MYCLIENT_SECRET,
‘callback’ => ‘startinvestimentos.com/mautic_test
));

try{
if ($auth->validateAccessToken()) {
if ($auth->accessTokenUpdated()) {
$accessTokenData = $auth->getAccessTokenData();
//store access token data however you want
}
}
echo ‘ok’;
} catch (Exception $ex) {
echo ‘erro’;
}


When i run it i was redirected to mymautic_url/oauth/v2/authorize, but page has 403 error (forbidden)

Someone knows what should i do for my code works?

Hello everyone!
I trying integrate mautic with my sass system (for send contacts, tags, etc).
I installed mautic in VPS.
My system is built in PHP, so i use this mautic repo https://github.com/mautic/api-library
But the follow code doesn’t works:

//defines
define('MYBASEURL', 'http://url-to-mautic-instance');
define('MYCLIENT_KEY', 'SOME_OAUTH2_KEY');
define('MYCLIENT_SECRET', 'SOME_OAUTH2_SECRET');

// Initiate the auth object
$auth = ApiAuth::initiate(array(
      'baseUrl' => MYBASEURL,
      'version' => 'OAuth2',
      'clientKey' => MYCLIENT_KEY,
      'clientSecret' => MYCLIENT_SECRET, 
      'callback' => 'startinvestimentos.com/mautic_test'
));

try{
      if ($auth->validateAccessToken()) {
            if ($auth->accessTokenUpdated()) {
                  $accessTokenData = $auth->getAccessTokenData();
                  //store access token data however you want
            }
      }
      echo 'ok';
} catch (Exception $ex) {
      echo 'erro';
}

When i run it i was redirected to mymautic_url/oauth/v2/authorize, but page has 403 error (forbidden)

Someone knows what should i do for my code works?