WordPress getting data from external API

If the API requires an authorization as Bearer token, just write is as Bearer and not as Basic:

$headers = array(
        'Content-Type' => 'application/x-www-form-urlencoded',
        'Authorization' => 'Beaerer Base64enodedusercredentials',
    );

Also take a look at the documentation of this API.

Also, make sure that you are currently duplicating the feedback in both of your functions. The 2nd function would be completely sufficient:

function api_authentication_test_shortcode() {
    return authenticate_api();
}
add_shortcode('api_authentication_test', 'api_authentication_test_shortcode');

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)