Basic auth failing with "Unsupported Authorization Type"

Using latest XDN 2.20.2, I have implemented basic auth in my router:

module.exports = new Router()
    username: process.env.BASIC_AUTH_USERNAME,
    password: process.env.BASIC_AUTH_PASSWORD,
  .match('/service-worker.js', ({ serviceWorker }) => {
    return serviceWorker('.next/static/service-worker.js')
  .use(nextRoutes) // automatically adds routes for all files under /pages

Locally, I am prompted for credentials when visiting the site. Authorization is successful.

When deployed, I am also prompted, but I get a 400 Invalid Argument response:

<Message>Unsupported Authorization Type</Message>
<ArgumentValue>Basic XXX</ArgumentValue>

When I enter incorrect credentials, I get an expected 403, but with correct credentials I see this 400 error. Is this an issue with my implementation?

Thank you for reporting this - we are looking into it.

We have isolated the issue and will be releasing a patch as soon as possible.

We have released v2.20.3 which fixes this issue. Could you test it and confirm?

Looks like the issue is fixed in 2.20.3. Thanks!

1 Like