Skip to content
New issue

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

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

Already on GitHub? # to your account

basic auth support #57

Closed
alessioalex opened this issue Nov 13, 2019 · 3 comments
Closed

basic auth support #57

alessioalex opened this issue Nov 13, 2019 · 3 comments

Comments

@alessioalex
Copy link
Contributor

Hey @feross would you be open to a pull request to support basic auth? I know there's already OAuth but basic auth is still used here and there.

@Flet
Copy link
Collaborator

Flet commented Dec 23, 2019

I wonder if this could be documented in the README like the oauth technique is (without adding code).

Maybe something like:

const user = 'someuser'
const pass = 'pa$$word'
const encodedAuth = Buffer.from(`${user}:${pass}`).toString('base64')

get('http://example.com', {
  headers: {
    'user-agent': `my-module/${pkg.version} (https://github.com/username/my-module)`,
    authorization: `Basic ${encodedAuth}`
  }
})

@alessioalex
Copy link
Contributor Author

Did not see that at the time I posted this. Considering that's the approach for OAuth, the http auth should be like the one in @Flet 's example (included in the README).

@feross feross closed this as completed in 81eaf56 Nov 18, 2020
@feross
Copy link
Owner

feross commented Nov 18, 2020

Thanks for the code snippet, @Flet. Just added it to the readme!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants