Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Basic Authentication with multiple sitemap files #17

Open
artemkolotilkin opened this issue Oct 30, 2016 · 3 comments
Open

Comments

@artemkolotilkin
Copy link

I need to parse a sitemap on a site protected by a basic authentication. If there is just one sitemap file and I pass basic auth parameters in the url like http://{user}:{pass}@example.com, it works great. But if sitemap.xml is just an index of sitemap files, then those files will not be parsed and an empty result set is returned.

It would be great to have a basic auth parameter in Sitemapper class that would be applied to all sitemap files.

@holloway
Copy link

holloway commented May 19, 2022

Hi @artemkolotilkin @seantomburke I added Basic Auth with the requestHeaders option.

const username = "username";
const password = "password123";

const usernamePasswordBuffer = Buffer.from(
  `${username}:${password}`,
  "utf-8"
);
const base64UsernamePassword = usernamePasswordBuffer.toString("base64");
const requestHeaders = {
  Authorization: `Basic ${base64UsernamePassword}`,
};
const sitemap = new Sitemapper({ requestHeaders });

It would be great if this was a built in feature.

@seantomburke
Copy link
Owner

@artemkolotilkin @holloway I think I'm in favor of @holloway's implementation and keeping that as an object passed into the requestHeaders.

We can add it to the README.MD as a way to help users implement it. Integrating username and password options that passes a plain text username and password strings feels less secure.

@thehideki81
Copy link

This doesn't seem to work correctly. I have an index file for index files, and I get 401 error for all subindex files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants