Home Express basic-auth-connect also protects bower
Reply: 0

Express basic-auth-connect also protects bower

Nfys Published in 2018-01-13 06:50:57Z

I am working on an Express+Angular SPA. I am trying to use "basic-auth-connect" as an additional authentication mechanism to restrict access to the login page to selected people. I have a different auth mechanism for logging into the app itself. I don't want to protect any routes, just the login page to which angular redirects. So I just plug the basic-auth middleware before the express.static middleware.

app.use(bodyParser.urlencoded({ extended: true }));

app.use('/signup', signup);
app.use('/login', login);
app.use('/blah', blah);
// ...

app.listen(port, function () {
  console.log('Running on PORT: ' + port);

app.use(basicAuth(username, password));
app.use(express.static(path.join(__dirname, '../../public')));

However it seems that this protects calls to bower assets so even when the user enters the basic auth credentials in the browser form, he cannot then login to the app itself because of errors like:

Source map error: request failed with status 401 Resource

Is there a way around this?


You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.298192 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO