This is an archived forum post. The information may be outdated. Contact us if you have any questions.

API V2 setHttpAuth

alparandr wrote on 2019-06-12:

I noticed that setHttpAuth method doesn't work. When I try to set username and password, I still get empty string in HTTP_AUTHORIZATION. Maybe I'm doing something wrong, but as I understand I have to get HTTP_AUTHORIZATION on my page using convertUrl method. Am I wrong? Could you please provide and example how to use this method or explain to me what I did wrong?

support wrote on 2019-06-13:
Hello Alex,

Please mail your source code using Pdfcrowd API to
support wrote on 2019-06-14:
Hello Alexander,
?It seems that the page you are trying to convert ( doesn't support HTTP basic authentication.
?Please try the following example. It works fine.
    try {
        $client = new \Pdfcrowd\HtmlToPdfClient('demo', 'ce544b6ea52a5621fb9d55f8b542d14d');
        $client->setHttpAuth("guest", "guest"); // settings username and password name to get access to, see
        $pdf = $client->convertUrl('');

        // set HTTP response headers
        header("Content-Type: application/pdf");
        header("Cache-Control: max-age=0");
        header("Accept-Ranges: none");

        echo $pdf;
    } catch (PdfcrowdException $err) {

DavidThompson1983 wrote on 2020-12-17:
Sorry I'm trying to find out how I would pass a firebase auth token?