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

HTTP Basic Auth #184

Closed
canac opened this issue Mar 5, 2016 · 3 comments
Closed

HTTP Basic Auth #184

canac opened this issue Mar 5, 2016 · 3 comments

Comments

@canac
Copy link

canac commented Mar 5, 2016

Does got support HTTP basic auth? The code references an auth option, but none seems to currently exist. Of course, I can manually base64 encode my authentication data and pass it in through the Authorization header, but I would expect an HTTP request library to do that for me.

@sindresorhus
Copy link
Owner

It's right in the linked Node.js docs: https://nodejs.org/api/http.html#http_http_request_options_callback

@canac
Copy link
Author

canac commented Mar 6, 2016

OK, now I see that the documentation says the options argument supports "any of the http.request options." I should have read it more carefully. Thanks for making this awesome module; it's a pleasure to use it!

vladikoff pushed a commit to webdriverio-community/node-geckodriver that referenced this issue Nov 2, 2017
This allows for usage of things such as basic auth, and other features
that node's built-in url library support that `got` expects.

I only tested this by installing node-geckodriver via

```
GECKODRIVER_CDNURL="https://${ght}@github.com/mozilla/geckodriver/releases/download" npm link ../node-geckodriver/
```

and confirmed that it no longer threw the error present in the upstream
issue sindresorhus/got#184

```
Error: Basic authentication must be done with auth option                                                                                                      │$: git co master
    at normalizeArguments (~/code/project/node_modules/got/index.js:215:10)
```
@monkekode
Copy link

For anyone coming to this issue from Google, like me, you now have to set username and password instead of the auth (user:pass) option.

vladikoff added a commit to webdriverio-community/node-geckodriver that referenced this issue Oct 19, 2022
This allows for usage of things such as basic auth, and other features
that node's built-in url library support that `got` expects.

I only tested this by installing node-geckodriver via

```
GECKODRIVER_CDNURL="https://${ght}@github.com/mozilla/geckodriver/releases/download" npm link ../node-geckodriver/
```

and confirmed that it no longer threw the error present in the upstream
issue sindresorhus/got#184

```
Error: Basic authentication must be done with auth option                                                                                                      │$: git co master
    at normalizeArguments (~/code/project/node_modules/got/index.js:215:10)
```
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

4 participants
@sindresorhus @canac @monkekode and others