Code Monkey home page Code Monkey logo

Comments (3)

rowanmanning avatar rowanmanning commented on May 18, 2024

Ah yes the issue is with your config. The config should be an exported object rather than JS code which runs with Pa11y. The following may work for you:

const credentials = 'mycredential:mypassword';
const encodedCredentials = new Buffer(credentials).toString('base64');

module.export = {
    defaults: {
        headers: {
            Authorization: `Basic ${encodedCredentials}`
        }
    },
    urls: [
        'https://my.example.com'
    ]
};

I'm going to close the issue, but let me know if this doesn't help!

from pa11y-ci.

dkay703 avatar dkay703 commented on May 18, 2024

@rowanmanning
Thank you for replying. Unfortunately, i'm getting the same 401 error.

Couple ways I configured config.js file is
1. The way you suggested, replacing "mycredential", "mypassword", and "urLs" accordingly.

const credentials = 'mycredential:mypassword';
const encodedCredentials = new Buffer(credentials).toString('base64');

module.export = {
defaults: {
headers: {
Authorization: Basic ${encodedCredentials}
}
},
urls: [
'https://my.example.com'
]
};

2. I also tried base 64ing the credential and commenting out two const at the top

//const credentials = '1000000003:dev1234$$';
//const encodedCredentials = new Buffer(credentials).toString('base64');

module.export = {
defaults: {
headers: {
Authorization: 'Basic hashed_credential'
}
},
urls: [
'https://myurl'
]
};

Both returns 401. In addition, I have noticed if i just run $pa11y-ci -c config.js, it doesn't pick up the url specified in the config. I have to specify the url in command line for pa11y to test against it for some reason i.e. $pa11y-ci -c config.js https://myurl.com

Thank you for the assistance !

from pa11y-ci.

seanahern avatar seanahern commented on May 18, 2024

Typo in the sample answer at s/module.export/module.exports but this helped!

Create some file, like pa11y-config.js:

const credentials = 'mycredential:mypassword';
const encodedCredentials = new Buffer(credentials).toString('base64');

module.exports = {
    defaults: {
        headers: {
            Authorization: `Basic ${encodedCredentials}`
        }
    },
    urls: [
        'https://my.example.com'
    ]
};

Run

pa11y-ci --config=./pa11y-config.js

from pa11y-ci.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.