enable basic auth at api gateway

Viewed 411

I've set up an express basic auth using the express-basic-auth module.

const basicAuthFunc = basicAuth({
    challenge: true,
    users: { 'admin': s.BASIC_AUTH.ADMIN_PASS }
})

it works on localhost. I'm prompted with a popup js challenge.

i'm deploying to lambda function and using AWS API gateway.

the page does not present me with the challange. I just get the 401 directly.
I tried removing the basic auth and the page loads so it's just related to the basic auth.

what headers should I add to api gateway ?

tried this one : https://medium.com/@Da_vidgf/http-basic-auth-with-api-gateway-and-serverless-5ae14ad0a270

adding WWW-Authenticate and 'Basic' to 401 response.

didn't workenter image description here

0 Answers
Related