Mautic Basic Authentication via Rest Api

According to the mautic developer documentation, I connect to the mautic main authorization using custom php using curl locally, but redirects me to the mautic login page, but in my opinion this is the wrong answer ....... I want to know What is the correct answer for this basic authorization ?



    $login = 'admin';
    $password = '123456';
    $url = 'http://127.0.0.1/mautic/'; //localhost
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
    curl_setopt($ch, CURLOPT_HTTPHEADER,
        array(
            "Authorization: Basic " . base64_encode($login . ":" . $password)
        ));

    $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $result = curl_exec($ch);
    print_r(curl_exec($ch));
    curl_close($ch);

Also I want to know if basic authentication in Mautik is different from Oauth2 authentication?

+4
source share
1 answer
+1

Source: https://habr.com/ru/post/1668362/


All Articles