How to use WebClientPrint with PHP Authentication enabled
Product WebClientPrint for PHP Published 08/22/2013 Updated 12/12/2016 Author Neodynamic
Overview
WebClientPrint is a client-server solution which means that it provides a server-side code (WebClientPrint.php) and a client-side software Windows, Linux, Raspberry Pi & Mac called WCPP (WebClientPrint Processor)
Both parts of WebClientPrint solution communicates through HTTP/HTTPS protocol. When the client-side utility (WCPP) connects to your website requesting a ClientPrintJob, it expects to get such object back to it. If your website requires user authentication, then when WCPP tries to get a ClientPrintJob from your site, it'll fail and an error message will be displayed to the user (usually a 401 Unauthorized HTTP Code is displayed or WCPP is redirected to a kind of LOGIN page). You must know that WCPP is unable to provide any user credentials for authentication so to get it working within a website with PHP Authentication enabled, a couple of changes must be done.
Depending on whether you're using a custom authentication process for your classic PHP website or using any PHP MVC Framework out there like Laravel, then general steps to get WebClientPrint solution to work within websites requiring user authentication would be the following:
- Be sure that the WebClientPrint.php file is configured to allow ANONYMOUS access!
- Be sure that the WebClientPrintController.php file is configured to allow ANONYMOUS access!
- Be sure that any PHP files that create and return a ClientPrintJob object (so the WCPP utility can process it) are configured to allow ANONYMOUS access!
That's it! Now WebClientPrint solution should work fine in your website with PHP Authentication enabled.