Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Web and WebWorks Development

Reply
New Contributor
ajgogo
Posts: 8
Registered: ‎06-15-2010
My Carrier: Telus

Widget:: XmlHttpRequest Authentication Problems

Hi,

 

We are developing a BlackBerry Widget that uses web-services. The calls to the webservices are done with  XMLHttpRequest and Basic Authentication.

 

In the simulator, we are able to get a success response, but on the device we get an error 401.  Here's an example of the code:

 

    var request2 = new XMLHttpRequest();
    request2.open("POST",url, true);
    request2.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    request2.setRequestHeader("Content-length", postData.length);
    request2.setRequestHeader("Authorization","Basic hash");
    request2.setRequestHeader("Connection", "close");
    request2.onreadystatechange = function() {
        if (this.readyState == 4) {
            alert(this.readyState + ": " + this.status);
        }
    };
     request2.send(postData);

 

The data sent is small (less than 1KB).

 

It sound similar to other posts on this forum.  Are there any fixes or workarounds?  Any help would be appreciated.  Thanks

 

AJ

Please use plain text.
New Contributor
ajgogo
Posts: 8
Registered: ‎06-15-2010
My Carrier: Telus

Re: Widget:: XmlHttpRequest Authentication Problems

Has anyone had similar issues?    Any advice would be appreciated.

 

Please use plain text.
New Contributor
ajgogo
Posts: 8
Registered: ‎06-15-2010
My Carrier: Telus

Re: Widget:: XmlHttpRequest Authentication Problems

Any thoughts or ideas?  Is this a bug?

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,693
Registered: ‎10-16-2008
My Carrier: Rogers

Re: Widget:: XmlHttpRequest Authentication Problems

Hi ajgogo,

 

We currently don't have the support for challenge response authentication in BlackBerry Widgets.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Developer
miamon
Posts: 142
Registered: ‎08-17-2008
My Carrier: Vodafone

Re: Widget:: XmlHttpRequest Authentication Problems

Here i have problems too with AJAX request with Basic Authentication.

 

It is not supported yet in SDK 2.3 for Smartphone?

 

same code works fine with PlayBook SDK 2.2

Josep Maria
Please use plain text.