Back to FAQs

Do Browser Bots support HTTP Basic or NTLM authentication?

Yes, Browser Bots can authenticate with HTTP Basic Authentication or NTLM, with some caveats.

To supply HTTP authentication credentials in your browser script, simply create a code block at the beginning of the script with a single line like this.

browser.setHttpAuthentication("myUsername", "myPassword");

You could also pull dynamic values from a dataset. This example assumes your dataset has two columns, with the username in the first column and the password in the second, and it is bound to a variable called auth.

const username = bot.getVariable("auth", 0);
const password = bot.getVariable("auth", 1);

browser.setHttpAuthentication(username, password);

Each Browser Bot can only set HTTP authentication credentials once, typically at the beginning of the script. After you set them, the Browser Bot will automatically pass them to any site that requires them. Take care not to leak your credentials to an untrusted 3rd party site if you are browsing multiple sites in the same script.

Unfortunately it’s not possible at this time to change the credentials later in the script, or use a different set of credentials for each domain, due to limitations in our browser automation libraries.

HTTP Basic and NTLM credentials are handled at the HTTP/S protocol layer. They are different from the more common web form authentication forms used on most sites today (the kind that uses cookies or local storage or similar). If your application has a web-based login form, chances are you can automate it using ordinary type and click steps instead of relying on HTTP Basic or NTLM authentication.