Basic Auth options parsing #253

ticup opened this Issue Jan 5, 2012 · 4 comments

4 participants



I wanted to try the basic auth func added in #202.
But it gives following error. (also when I simply use the code given in the 202 pull request)
I shortly gave it a look and apparantly it fails at parsing the options correctly for the credentials and @credentials.scheme is undefined.

node: v 0.6.6
npm 1-1-0-beta-4
zombie: latest through "npm install zombie"

error message:
throw e; // process.nextTick error, or 'error' event on first tick
TypeError: Cannot call method 'toLowerCase' of undefined
at History._resource (/Users/tim/Documents/workspaceNode/EssenCrawler/node_modules/zombie/lib/zombie/
at History._pageChanged (/Users/tim/Documents/workspaceNode/EssenCrawler/node_modules/zombie/lib/zombie/
at History._assign (/Users/tim/Documents/workspaceNode/EssenCrawler/node_modules/zombie/lib/zombie/
at /Users/tim/Documents/workspaceNode/EssenCrawler/node_modules/zombie/lib/zombie/
at Browser.withOptions (/Users/tim/Documents/workspaceNode/EssenCrawler/node_modules/zombie/lib/zombie/
at Browser.visit (/Users/tim/Documents/workspaceNode/EssenCrawler/node_modules/zombie/lib/zombie/
at Function.visit (/Users/tim/Documents/workspaceNode/EssenCrawler/node_modules/zombie/lib/zombie/
at Object. (/Users/tim/Documents/workspaceNode/EssenCrawler/test.js:12:8)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)



Your credentials should look like this:

credentials: { scheme: "basic", username: "bloody", password: "hungry" }

that explains it, thanks a lot.

Maybe there should be 3 lines of doc about this somewhere?

Suggestion: On the API page there is:

Browser Options

You can use the following options:

credentials -- Object containing authorization credentials.


credentials -- Object containing authorization credentials. The object should contain following information: { scheme: ('Basic' | 'Digest'), username: 'username', password: 'password' }.

@assaf assaf closed this in d79974b Jan 12, 2012

just gave this a try and I got a funny error, if I pass username and password, password is correctly set but username is undefined in the auth header, if I pass user and password, username is correctly set but password is just p... if I pass username, password, and user, then it finally seems to work.

credentials: {
scheme: "basic",
user: "test",
password: "pwd"


I was passing in just username and password and got a 401 error (authentication). User and password worked though.

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