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

Basic auth doesn't work #1383

Closed
epicfaace opened this issue Jul 30, 2020 · 1 comment
Closed

Basic auth doesn't work #1383

epicfaace opened this issue Jul 30, 2020 · 1 comment

Comments

@epicfaace
Copy link

Strangely, this doesn't work (gives me back a 403):

const auth = { username: "...", password: "..."};
const { results } = await got(CENSYS_IPV4_ENDPOINT, { ...auth }).json();

But using this request does work:

    const { results } = await got(CENSYS_IPV4_ENDPOINT, {
      headers: {
        Authorization:
          'Basic ' +
          Buffer.from(`${auth.username}:${auth.password}`).toString('base64')
      }
    }).json();

Am I perhaps using the basic auth functionality of got incorrectly in the first example?

@szmarczak
Copy link
Collaborator

Duplicate of #1169

@szmarczak szmarczak marked this as a duplicate of #1169 Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants