views:

536

answers:

3

Is there any way to pass HTTP AUTH username and password along with an Ajax.request()? Basically, I'm trying to find the equivalent of:

curl user:pass http://url.com

Is seems this has to be available, but I can't figure it out. If not, is there another JS alternative?

A: 

I know that someone wrote a user extension for the ExtJs library that provides configuration options for Basic Authentication in standard Ajax requests, and automatically handles the Base64 encoding.

http://extjs.com/forum/showthread.php?t=21681

Steve -Cutter- Blades
+3  A: 

I'm not sure about Prototype, but you can pass the username and password as the fourth and fifth arguments of the underlying open method of XmlHttpRequest, as shown here.

Jed Schmidt
@jed: Any chance you could post a sample code snippet here that shows how to manipulate the XmlHttpRequest.open() method directly from Prototype (if you know how)?
arrocharGeek
A: 

Did you figure out a way to do this? I'm also trying to do HTTP Authentication with Prototype's Ajax.Request().

Justin

Justin Mitchell
Never found a way to do it with Prototype. Would be nice though.
Ian Silber