Capturing assets protected with authentication

👍

Covered in this doc

How to pass request headers to Percy

If the app or website you're taking snapshots of is protected with authentication, you can configure Percy to pass the needed authentication headers. Without passing authentication to Percy, snapshots can be broken (since we won't be able to save the needed assets to render the page).

This can done as a per-snapshot option or added to your global Percy SDK config. You can pass any request headers as a snapshot option. For example, (in our Cypress SDK) using basic auth:

cy.percySnapshot('Home page', {
  requestHeaders: {
    Authorization: 'Basic dXNlcm5hbWU6cGFzc3dvcmQ='
  }
});

Or, as a SDK config option (as a .percy.yml file):

version: 1
agent:
  asset-discovery:
    request-headers:
      Authorization: 'Basic dXNlcm5hbWU6cGFzc3dvcmQ='

You can pass any kind of header your website or application requires to properly authenticate.