Skip to content

I get Class 'Mautic\\Auth\\ApiAuth' not found since updated  #266

@miquelangeld

Description

@miquelangeld

Since we updated to the current Mautic Version 4.2.0 I get this error:

Uncaught Error: Class 'Mautic\\Auth\\ApiAuth' not found

I created a new server from the scratch and I get the same error. We did this conector, which worked fine until now:

<?php
  include 'vendor/autoload.php';
  use Mautic\Auth\ApiAuth;
  use Mautic\MauticApi;
//define function name  

  session_start();

  $settings = array(
      'userName'         => 'user',
      'password'         => 'pass',
  );

  $initAuth   = new ApiAuth();
  $auth       = $initAuth->newAuth($settings, 'BasicAuth');

  try{
    if ($auth) {
      $api        = new MauticApi();
      $contactApi = $api->newApi("contacts", $auth, 'https://mautic/api/');
      file_put_contents('conector.log', 'REQUEST: '.print_r($_REQUEST,true),FILE_APPEND);
            if($_REQUEST['action'] == "new"){
                $firstname = $_REQUEST['firstname'];
                $lastname = $_REQUEST['lastname'];
                $email = $_REQUEST['email'];
                $company = $_REQUEST['company'];
                $country = $_REQUEST['country'];
                $preferred_locale = strtolower($_REQUEST['preferred_locale']);
                $birthdate = $_REQUEST['birthdate'];
                $gender = $_REQUEST['gender'];
                $crm_source = $_REQUEST['crm_source'];

       $data = array(
        'firstname'     =>      $firstname,
        'lastname'      =>      $lastname,
        'email'     =>  $email,
        'company'       =>      $company,
        'country'       =>      $country,
        'preferred_locale'      =>      $preferred_locale,
        'birthdate'      =>      $birthdate,
        'gender'        =>      $gender,
        'crm_source'    =>      $crm_source
        );


        $contact = $contactApi->create($data);

        file_put_contents('conector.log', 'CONTACT API '.print_r($contact,true),FILE_APPEND | LOCK_EX);
        $idcontacto = $contact['contact']['id'];
 }else if($_REQUEST['action'] == "delete"){
        $contact = $contactApi->delete($_REQUEST['idContact']);
      }

    } else {
                echo "Error!";
    }
  } catch (Exception $e) {
        echo "Mautic not connected!";
  }
?>


<bountysource-plugin>

---
Want to back this issue? **[Post a bounty on it!](https://app.bountysource.com/issues/108499070-i-get-class-mautic-auth-apiauth-not-found-since-updated?utm_campaign=plugin&utm_content=tracker%2F10940535&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://app.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F10940535&utm_medium=issues&utm_source=github).
</bountysource-plugin>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions