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

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

Open
miquelangeld opened this issue Mar 10, 2022 · 1 comment
Open

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

miquelangeld opened this issue Mar 10, 2022 · 1 comment

Comments

@miquelangeld
Copy link

miquelangeld commented Mar 10, 2022

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>
@miquelangeld miquelangeld changed the title I get Class 'Mautic\\Api\\Api' not found since updated I get Class 'Mautic\\Auth\\ApiAuth' not found since updated Mar 11, 2022
@escopecz
Copy link
Member

How did you install the library? It looks like it missing from the autoload.php or from vendor folder

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

2 participants