Mautic Community Forums

Cannot get API Token with api-library

I’m trying to use mautic api-library to create a contact in my mautic installation from another application. My app is a symfony app and I couldn’t find a Bundle to use with api-library. So I’m trying to use the library directly from code.



After reading api-library docs, my code to request a token looks like this:

Code:
$auth = new ApiAuth(); $auth->newAuth($settings); try { if ($auth->validateAccessToken()) { }

But I'm getting this error:
Quote:
Fatal error: Call to undefined method MauticAuthApiAuth::validateAccessToken()

I saw that api-library code uses reflection to instantiate an ApiAuth class and return OAuth class, but looks like it's not working. Maybe my PHP version? I've tried all the possibilities. Any ideia on how to solve it?

Thanks!

I’m trying to use mautic api-library to create a contact in my mautic installation from another application. My app is a symfony app and I couldn’t find a Bundle to use with api-library. So I’m trying to use the library directly from code.

After reading api-library docs, my code to request a token looks like this:

$auth = new ApiAuth();
$auth->newAuth($settings);
try {
    if ($auth->validateAccessToken()) {
  }

But I’m getting this error:

I saw that api-library code uses reflection to instantiate an ApiAuth class and return OAuth class, but looks like it’s not working. Maybe my PHP version? I’ve tried all the possibilities. Any ideia on how to solve it?

Thanks!

Any ideas?

Guys, can you help me with this issue? Looks stupid, but it’s two weeks I’m trying a simple integration with mautic from my symfony app. I have this stackoverflow thread also:

http://stackoverflow.com/questions/39157624/attempted-to-call-an-undefined-method-named-validateaccesstoken-when-using-mau

Thanks in advance.