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

ProxyAgent can only use basic authentication #1704

Closed
oooshima opened this issue Oct 15, 2022 · 3 comments
Closed

ProxyAgent can only use basic authentication #1704

oooshima opened this issue Oct 15, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@oooshima
Copy link
Contributor

oooshima commented Oct 15, 2022

This would solve...

Basic authentication is hard coded at

this[kProxyHeaders]['proxy-authorization'] = `Basic ${opts.auth}`

Sometimes we have to use other authentication. (Bearer etc..)

The implementation should look like...

Add additional parameter to options, which is type of authentication.
Can I like to send a PR to fix this?

I have also considered...

I think it is better to add an option because erasing the hard code is breaking changes.

@oooshima oooshima added the enhancement New feature or request label Oct 15, 2022
@cola119
Copy link
Member

cola119 commented Oct 15, 2022

How about adding a new option like opts.token and set it directly to this[kProxyHeaders]['proxy-authorization']?

if (opts.token) {
  this[kProxyHeaders]['proxy-authorization'] = opts.token
}
// user land
const agent = new ProxyAgent({
  uri: 'my.proxy.com',
  token: 'Bearer xxxx'
})

@ronag
Copy link
Member

ronag commented Oct 15, 2022

PR welcome

@oooshima
Copy link
Contributor Author

Thanks for the answer!
I have created a PR and would appreciate a review.
#1705

@ronag ronag closed this as completed Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants