When calling render_pdf() or render_screenshot() from a controller action, the user's auth allows for rendering the HTML and no additional authentication is required. However, when rendering an object directly, the headless Chrome instance doesn't have a way to authenticate.
Grover handles this by allowing users to pass in username: and password: kwargs:
# Grover
Grover.new('<some URI with basic authentication', username: 'the username', password: 'super secret').to_pdf
Ferrum has the ability to add basic auth credentials to a page:
I was able to patch in a less-than-robust solution by accepting credentials in each render_thing() method and then add the Authorization: Basic header to the Ferrum.page object in the ferrum_pdf gem here, but this may not be the best long-term solution.
When calling
render_pdf()
orrender_screenshot()
from a controller action, the user's auth allows for rendering the HTML and no additional authentication is required. However, when rendering an object directly, the headless Chrome instance doesn't have a way to authenticate.Grover handles this by allowing users to pass in
username:
andpassword:
kwargs:Ferrum has the ability to add basic auth credentials to a page:
I was able to patch in a less-than-robust solution by accepting credentials in each
render_thing()
method and then add theAuthorization: Basic
header to the Ferrum.page object in theferrum_pdf
gem here, but this may not be the best long-term solution.